Pacific-Design.com

    
Home Index

1. Python

2. Date

Python / Date /

#!/usr/bin/python 
#--------------------------------------------------------#
import datetime
base = datetime.datetime.today()

for x in range(0, 10):
    data = base - datetime.timedelta(days=x)
    print str(data)[:10]

2017-02-16
2017-02-15
2017-02-14
2017-02-13
2017-02-12
2017-02-11
2017-02-10
2017-02-09
2017-02-08
2017-02-07