Datetime display


#1

here’s the code that I made in Pretty Time lesson 5/6:


from datetime import datetime
now = datetime.now()

print '%s:%s:%s' % (now.hour, now.minute, now.second)

Is displayed “23:52:51” which means it’s 11:52 pm
However, the time in my clock is 7:57 AM. Is this because of timezones?


#2

yes, the time is standard utc0, which is i London.

if you want your timezone, you have to activate it:

https://stackoverflow.com/questions/1111317/how-do-i-print-a-python-datetime-in-the-local-timezone