![](/img/trans.png)
[英]Determine date and time from a fixed date given seconds elapsed since fixed date in python
[英]Time and date on the basis of seconds elapsed since 1970 year
使用python我必須檢索事件的時間和日期的值,知道自01/01/1970 00:00:00
以來經過了幾秒鍾。
我開始時:
from datetime import timedelta
a = timedelta(seconds=1317365200)
print "%d days %02d:%02d:%02d" % (a.days, a.seconds / 3600, (a.seconds / 60) % 60, a.seconds % 60)1317365200
經過的秒數記錄存儲在Sqlite 3數據庫中。
from datetime import datetime
a = datetime.fromtimestamp(1317365200)
print a
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.