Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 时间戳不正确的小时数_Python_Timestamp - Fatal编程技术网

Python 时间戳不正确的小时数

Python 时间戳不正确的小时数,python,timestamp,Python,Timestamp,在Python程序中,我使用时间戳。 其形式如下: timestamp=time.strftime('%Y/%m/%d %H:%M:%S') 分钟和秒是正确的,但小时是不正确的(10小时,在我的Python程序中是8小时) 我将日期时间放在MySQL数据库(raspberry pi)中。我曾经尝试过以下方法: 从日期时间导入*导入pytz utc=pytz.时区(“欧洲/布鲁塞尔”) 今天=datetime.now().replace(tzinfo=utc) 仍然显示两个小时的差异。。。。 有

在Python程序中,我使用时间戳。 其形式如下:

timestamp=time.strftime('%Y/%m/%d %H:%M:%S')
分钟和秒是正确的,但小时是不正确的(10小时,在我的Python程序中是8小时)

我将日期时间放在MySQL数据库(raspberry pi)中。我曾经尝试过以下方法:

从日期时间导入*导入pytz utc=pytz.时区(“欧洲/布鲁塞尔”) 今天=datetime.now().replace(tzinfo=utc)

仍然显示两个小时的差异。。。。
有人能帮我吗

你能多加一点背景吗?
time
是时间模块还是其他模块?您确定时区没有更改吗?编辑您的问题,而不是将其添加为答案。我的意思是,
time.strftime()
使用本地时间,如果您不向它传递时间。我必须使用什么来代替time.strftime()?我是说,
time.strftime()
与您的计算机的时间相同,因为Python脚本是在您的计算机上执行的。因此,我无法复制这个问题。换句话说,还有另一个问题。啊,好的,谢谢。我电脑的时间不是我在任务栏上看到的时间(因为这是正确的)?你知道我在哪里可以看到/换衣服吗