1

Is there a python module/snippet which can decode the integer datestamps contained in OSX - specifically mail - plists?

EG, this bit:

<key>date-sent</key>    
<integer>1264001747</integer>

is likely in Jan 2010.

How to deconstruct? I'm aware of the very good plistlib - but this only gets me to that integer.

4

1 回答 1

1

您可以使用datetime.datetime.fromtimestamp

>>> import datetime
>>> datetime.datetime.fromtimestamp(1264001747)
datetime.datetime(2010, 1, 20, 10, 35, 47)

该值1264001747是从纪元开始以秒为单位给出的时间戳。返回的datetime对象按顺序显示(year, month, day, hour, minute, second)

于 2015-06-02T18:16:18.017 回答