Skip to content

Instantly share code, notes, and snippets.

@asmedrano
Created August 9, 2013 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asmedrano/6196275 to your computer and use it in GitHub Desktop.
Save asmedrano/6196275 to your computer and use it in GitHub Desktop.
What hour of the year is it?
import datetime
now = datetime.now()
day_of_year = now.timetuple().tm_yday
current_hour_of_day = now.timetuple().tm_hour
hour_of_year = day_of_year * 24 - 24 + current_hour_of_day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment