简体   繁体   中英

time difference between utc and python datetime() time

with python's datetime package, I'm seeing a ~8min time difference between datetime.now().timestamp() and datetime(year, month, day, hour, minute, second, [tz]).timestamp(), when I put now's time in the latter formula. With or without the tz, which is timezone, the 8min difference stays there. Anyone can explain where it went wrong? Thanks!

You can (and should) use tzinfo.localize() instead.

https://stackoverflow.com/a/6411149/1114412

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