-
-
Save gryf/72bb1d6f09d9ebc5077e2ddd74c32132 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env 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.') | |
| show_all = parser.parse_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