How to Create Negative Epoch Value in python -


i trying create epoch values date field using python. works great dates after '1970-01-01'. date before 1970 doesn't work.

here code using:

int(time.mktime(time.strptime('1969-01-01', '%y-%m-%d'))) - time.timezone 

error:

overflowerror: mktime argument out of range 

is there alternative way create negative epoch value?

from documentation of time module:

the functions in module may not handle dates , times before epoch or far in future.

so that's out. suggest using datetime module instead, can handle dates in years between 1 , 9999. i'm afraid without knowing use case can't of more help.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -