optionally print to localtime to avoid confusion
@@ -14,6 +14,7 @@ to_zone = tz.tzlocal()
opt_parser = optparse.OptionParser()
opt_parser.add_option("-f", "--format", dest="format",
default='%Y-%m-%d %H:%M:%S')
+opt_parser.add_option('-l', "--local", dest="local", action="store_true")
opts, args = opt_parser.parse_args()
for line in fileinput.input(args):
@@ -21,6 +22,7 @@ for line in fileinput.input(args):
tweet = json.loads(line)
created_at = dateutil.parser.parse(tweet["created_at"])
# convert to local time
+ if opts.local:
created_at = created_at.astimezone(to_zone)
print(created_at.strftime(opts.format))
except ValueError as e:
