I’m facing a problem with dates in python. I’m getting different results with mktime, in different places.
On my local server, if I try:
>>> from datetime import date
>>> from time import mktime
>>> mydate = date(2008,1,1)
>>> mktime(mydate.timetuple())
1199156400.0
>>> mydate2 = date(1998,1,1)
>>> mktime(mydate2.timetuple())
883620000.0
But if I try it on another server, I get:
>>> mydate = date(2008,1,1)
>>> mktime(mydate.timetuple())
1199152800.0
>>> mydate2 = date(1998,1,1)
>>> mktime(mydate2.timetuple())
883620000.0
Note that, in the fisrt case, the result was different. But in the second, it was the same.
Both python versions are the same.
I’ve also checked some time variables, like accept2dyear, altzone, daylight, tzname and timezone They are the same in both servers too.
Should I check some other thing?
In My local server, my timezone is set as America/Bahia, and in the other server it’s America/Sao_Paulo.
In some years, the daylight wasn’t applied to Bahia, so it seems that it was causing this one-hour difference between times.