furas

datetime - timedelta

Aug 4th, 2018
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import datetime
  2.  
  3. periods = [0, 178, 356, 534]
  4.  
  5. today = datetime.datetime.today()
  6.  
  7. dates = []
  8.  
  9. for n in periods:
  10.     dates.append( (today - datetime.timedelta(days=n)).strftime("%Y%m%d %H:%M:%S %Z") )
  11.  
  12. print(dates)
  13.  
  14. # and now use loops with `dates`
RAW Paste Data