Any Way to Fix the Incorrect Time and Date?


#1

Is there any way to fix this:

When I use the code, “datetime.now()” and print it, the date is a day off, and the time is not accurate either.


FAQ: Learn Python - Date and Time - Getting the Current Date and Time
#2

Hi @mentosandcheese,

It looks to me like the server’s time is in UTC, and after accounting for that, it gives the correct output. If you factor in timezone differences, does it still display a different time/date than yours?


#3

Hi! Mine shows the correct date, but the time is off by an hour. It appears to be taking winter time rather than summer time - e.g. it is currently 14:15, but I get a time of 13:15 in my output. Is there any way to fix this?


#4

No, sorry. The date/time you get are based on what the server is set to, regardless of where you are.