擅长:python、mysql、java
<p>伊曼纽尔</p>
<p>改变Python的时代可能需要很多工作。在调用datetime.utfromtimestamp之前,对LibreOffice时间戳进行一些计算,将其转换为Posix时间戳可能会更容易。</p>
<p>但是,如果你在1970年1月1日之前使用时间戳的话,这是行不通的。</p>
<pre><code>from datetime import datetime
tt = 1217099350.0
tt2 = (tt / 86400.) + 29226.
# At this point tt2 has days since the LibreOffice Epoch. Below, it
# is converted to seconds since Posix epoch.
tt3 = tt2 - 25569. # There are 25569 days between LibreOffice and Posix epoch
tt4 = tt3 * 86400. # Convert timestamp from days to seconds
tt5 = datetime.utcfromtimestamp(tt4).strftime("%Y-%m-%d %H:%M:%S")
print(tt5)
2018-07-31 19:09:10
</code></pre>