Skip to content

Instantly share code, notes, and snippets.

@dulek
Created October 5, 2016 11:29
Show Gist options
  • Save dulek/3d5509a6029830cce9d9da63f9c28983 to your computer and use it in GitHub Desktop.
Save dulek/3d5509a6029830cce9d9da63f9c28983 to your computer and use it in GitHub Desktop.
#!/bin/python
import argparse
from datetime import datetime
from pytz import common_timezones, timezone
parser = argparse.ArgumentParser(description="Tells you if it's Thursday "
"anywhere in the world.")
parser.add_argument('--all', action='store_true', default=False,
help='Print all timezones with Thursday.')
args = parser.parse_args()
show_all = args.all
all_tzs = []
for tz in common_timezones:
date =
timezone('Europe/Warsaw').localize(datetime.now()).astimezone(timezone(tz))
if date.weekday() == 3:
if not show_all:
print "YES, in %s!" % tz
break
else:
all_tzs.append(tz)
else:
if not all_tzs:
print "NO!"
else:
print "YES, in:\n%s!" % "\n".join(all_tzs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment