2012年1月9日星期一

python data time

在 python 獲得 timestamp

import datetime
today = datetime.date.today()
current = datetime.datetime.now()

print current.strftime('%Y%m%d-%H%M%S')

20120109-140126

strftime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
ref: http://pythonly.blogspot.com/2008/12/python.html

0 意見: