Why does the datetime.now( ) say it is tomorrow?



When I type datetime.now() The Console says it is tomorrows date, not today. My computer says the correct date though.

print datetime.now()

Wrong time
Python code academi time showing the wrong time /why?

Hi @jellehfish,

When you run your Python code on Codecademy’s server, and have it look up the time, it will use their system clock. Let’s check it out.

Among Codecademy’s offerings is Learn the Command Line. There, you use a UNIX operating system to perform tasks. On the command line, you are not limited to the tasks specified in the instructions.

Let’s try the date command …

Notice that the result includes UTC, for “Coordinated Universal Time”. Since your Python code is also running in their server, it also uses their clock, which differs from the time in your local time zone.

If you have Python installed on your local machine, it will use your local clock when you program in that environment.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.