Hi. I ran the following code: from datetime import datetime now = datetime.now() print '%s:%s' % (now.hour, now.minute) Its giving the output as 18:56 But the current time is 12:29 AM I dont know why this error is coming. Please help. Thnks
My understanding is that you're running this code from a server. When you call datetime, the information returned belongs to the server that is running your code, and not your local computer.
You can test this by running the same code on your local host using an interpreter or any IDE. Then you will see 12:39am as the time.
The code is working on Python IDE on my PC. Thanks a lot.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.