Skip to content

Instantly share code, notes, and snippets.

@jomat
Last active February 21, 2018 12:14
Show Gist options
  • Save jomat/a4e284bf5b19f5aef806 to your computer and use it in GitHub Desktop.
Save jomat/a4e284bf5b19f5aef806 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import pytz, datetime
now_utc = datetime.datetime.utcnow()
now_utc = pytz.utc.localize(now_utc)
for tzstring in pytz.all_timezones:
local_tz = pytz.timezone(tzstring)
local_time = now_utc.astimezone(local_tz)
h=int(local_time.strftime('%H'))
if h==16 or h == 15 or h == 4 or h == 3:
m=int(local_time.strftime('%M'))
if (m <= 20 and (h == 4 or h == 16)) or (m > 20 and (h==3 or h == 15)):
print tzstring+": "+local_time.strftime('%H:%M')
@undermink
Copy link

\o/

@undermink
Copy link

undermink commented Feb 21, 2018

I'll keep that thing and give it an alias like "is_it_beertime" :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment