Python control and Calculating Date
import datetime
today = datetime.date.today( )
yesterday = today - datetime.timedelta(days=1)
tomorrow = today + datetime.timedelta(days=1)
print yesterday, today, tomorrow#emits:
today = datetime.date.today( )
yesterday = today - datetime.timedelta(days=1)
tomorrow = today + datetime.timedelta(days=1)
print yesterday, today, tomorrow
2004-11-17 2004-11-18 2004-11-19
from datetime import date
from dateutil.relativedelta import relativedelta
print "today:" + date.today()
lastmonth = date.today() - relativedelta(months=1)
print "lastmonth:"+ lastmonth
Result : today: 2018-03-26
lastmonth: 2018-03-26
Find File Created date
time.ctime(os.path.getctime("first.txt"))
댓글
댓글 쓰기