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: 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"))




댓글

이 블로그의 인기 게시물

spring boot as a windows service

Properties

PHP Date format