Ask coding questions

← Back to all posts
The date today Bug in Python
h
IcynDevz (765)

So as you may know already(for python people). This

import datetime 
x = datetime.datetime.now()

print(x.strftime("%x"))

The ouput should be the day's date. And in this case(at least when this post was posted)

03/01/2021

But as you can see here

My code

The output

It prints tomorrow's date (03/02/2021).

Is this a bug or what?

Please fix this mods

Note that this was posted on 03/01/2021, NOT on 03/02/2021 that's why it is not working
Answered by EpicGamer007 (1644) [earned 5 cycles]
View Answer
Comments
hotnewtop
EpicGamer007 (1644)

Different timezones. It is probably showing the date for people who live east. At the time you are posting this, it is early morning in the uk, which is where most clocks in python, etc are set to.