Skip to content

Instantly share code, notes, and snippets.

@jacobg
Last active October 2, 2016 15:34
Show Gist options
  • Save jacobg/6437183 to your computer and use it in GitHub Desktop.
Save jacobg/6437183 to your computer and use it in GitHub Desktop.
For 02-Oct-2016 in Baltimore. Sunrise/set times from myzmanim.com
from datetime import date, datetime, time, timedelta
today= date.today()
sunrise = datetime.combine(today, time(7,3,56))
sunset = datetime.combine(today, time(17,46,35))
dawn = sunrise - timedelta(minutes=72)
dusk = sunset + timedelta(minutes=72)
earliest_time = min(dawn + (dusk-dawn)*5/12, sunrise + (sunset-sunrise)*5/12)
print('Earliest time = %s' % earliest_time.isoformat())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment