I\'m wondering if there is a python function/module that calculates the local time after midnight (or local solar time) given the UTC time and longitude? It doesn\'t need to
For a very simple function & very very approximated local time: Time variation goes from -12h to +12h and longitude goes from -180 to 180. Then:
import datetime as dt
def localTimeApprox(myDateTime, longitude):
"""Returns local hour approximation"""
return myDateTime+dt.timedelta(hours=(longitude*12/180))
Sample calling: localTimeApprox(dt.datetime(2014, 7, 9, 20, 00, 00), -75)
Returns: datetime.datetime(2014, 7, 9, 15, 0)