0

I have this unusual time format.

t1367071200

or

t1367063100

Google does not say much but they do say it's a time like 18:00. Do you have any clue how to read this string so that I can figure out the time? Or something I can read about it cuz I'm seeing this for the first time.

4

2 回答 2

5

这是一个UNIX 时间戳

In [2]: datetime.datetime.fromtimestamp(1367071200)
Out[2]: datetime.datetime(2013, 4, 27, 18, 0)

In [4]: datetime.datetime.fromtimestamp(int('t1367071200'[1:]))
Out[4]: datetime.datetime(2013, 4, 27, 18, 0)
于 2013-04-27T15:31:13.877 回答
1

它是一个 Unix 时间戳,您可以使用time模块或datetime模块将其转换为人类可读的形式:

[11]: strs="t1367071200"

In [12]: import time

In [13]: time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(float(strs[1:])))
Out[13]: '2013-04-27 14:00:00'
于 2013-04-27T15:32:42.280 回答