Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 19 lines (15 sloc) 588 Bytes
#!/usr/bin/env python
import argparse
import wtftz
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='WTF Timezones?! Convert a '
'time from utc (default) to another tz.')
parser.add_argument('time', help="The time to convert")
parser.add_argument('to', help="The target timezone")
parser.add_argument('from_tz', metavar="from", nargs="?",
default="utc", help="The source timezone.")
args = parser.parse_args()
try:
print(wtftz.convert(args.time, args.to, args.from_tz))
except Exception:
print(args.time)