The following code in Python is only returning the first digit of the minutes for local sunrise. This seems to be connected to the datetime.datetime object suntime.Sun uses. Any ideas on why I’m not getting two digits?
<code>import suntime
longitude = -117.5975
latitude = 33.4098
sun = suntime.Sun(latitude, longitude)
sunrise = sun.get_local_sunrise_time()
sunrise_h = sunrise.hour
sunrise_m = sunrise.minute
print(sunrise_m)
</code>
<code>import suntime
longitude = -117.5975
latitude = 33.4098
sun = suntime.Sun(latitude, longitude)
sunrise = sun.get_local_sunrise_time()
sunrise_h = sunrise.hour
sunrise_m = sunrise.minute
print(sunrise_m)
</code>
import suntime
longitude = -117.5975
latitude = 33.4098
sun = suntime.Sun(latitude, longitude)
sunrise = sun.get_local_sunrise_time()
sunrise_h = sunrise.hour
sunrise_m = sunrise.minute
print(sunrise_m)
Looking at the variable “sunrise” during debug I only see the first digit in the datetime.datetime returned object. I’d like the second digit as 6:20am is significantly different from say…6:29am
New contributor
Hamhanded is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.