close
在做備份的程式的時候常常會用到
要怎麼取得前一天的日期呢
import datetime
yday=datetime.date.today() - datetime.timedelta(days=1)
print yday.strftime("%y%m%d")
cf.
datetime - Formatting "yesterday's" date in python - Stack Overflow
http://stackoverflow.com/questions/1712116/formatting-yesterdays-date-in-python
the jackol’s den » Blog Archive » Yesterday’s date in Python
http://www.thejackol.com/2005/07/01/yesterdays-date-in-python/
文章標籤
全站熱搜
留言列表