How to get the local time?


#1

The command datetime.now() seems to return the UTC. Is there another command to get the local time?


#2

That is a good question. I think you have to modificate the library...in this case datetime custom is vinculated with the city of codeacademy i think. But if you download python and write in your python, i think that would show de localtime.


#3

I am going to try this right now.


#4

Like i said...Seems to work.
In my python shows the localtime (the time where i live, in my case Brazil).


#5

Thanks for posting this, I was wondering too. It seems misleading that the lesson does not mention datetime.now() pulls the current time in UTC, not your local time. My cat and I were sitting here wondering where it got Feb 2 3:28, when it's Feb 1 7:28 right now. It would be helpful if they would note that (unless I just missed it...)