我想找到最后一个午夜时间戳(唯一的输入是当前时间戳)。最好的方法是什么?在
我正在为一个全球移动应用程序编写python脚本。用户请求当前的时间戳,在服务器端,我想找到没有影响时区参数的用户的最后一个午夜时间戳。在
我找过了,找到了解决办法
import time
etime = int(time.time())
midnight = (etime - (etime % 86400)) + time.altzon
这对我很有效。但是我对time.altzon
函数感到困惑,它是否会给不同时区的用户带来任何问题。在
Tags:
要获得客户端(移动)的午夜时间戳,您需要知道客户端的时区。在
输出
^{pr2}$注意:在我的机器上,@phihag's answer产生的
1344470400.0
与上面的不同(我的机器不在纽约)。在相关问题 更多 >
编程相关推荐