简体   繁体   中英

UNIX time is too long

I've got this number 13008365973607952 and I know that it corresponds to Thursday, 21 March 2013 19:59:33 . However, for me this number seems too long. When I use Python's time.time() function I get only 1363901872.498432 , which is as long as mention before if you drop the dot, but then it becomes too big (value).

Can anyone tell me how to get such a valid number?

secsAfterADEpoch = float(your_weird_time) / 10000000.0 # seconds since jan 1st 1601
ADToUnixConvertor = ((1970-1601) * 365.242190) * 86400 # unix epoch - AD epoch * number of tropical days * seconds in a day
unixified = (secsAfterADEpoch-ADToUnixConvertor)+31800 # unix Timestamp version of AD timestamp + correction time

Erm try this?

Note: +31800 was something i had to add to the equation most likely to my timezone or some mathematical issue in the previous calculations.. so if your's doesn't work keep in mind i'm +1 GMT (or CET) so removing it or changing it accordingly might be a good idea if you get close results but not spot on :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM