fork download
  1. from time import time, mktime
  2. from datetime import datetime, timedelta
  3.  
  4. # calculate remaining days to the year 2045
  5. ts = time()
  6. print datetime.fromtimestamp(ts).strftime('%Y/%m/%d %H:%M:%S')
  7.  
  8. ts_xday = mktime(datetime.strptime('2045/1/1', '%Y/%m/%d').timetuple())
  9. delta1 = timedelta(seconds=(ts_xday - ts))
  10. print delta1
  11.  
  12. # when is the date which 10000 days remain.
  13. ts10000 = ts_xday - timedelta(days=10000).total_seconds()
  14. print datetime.fromtimestamp(ts10000).strftime('%Y/%m/%d')
  15.  
Success #stdin #stdout 0s 24616KB
stdin
Standard input is empty
stdout
2017/03/26 14:23:39
10142 days, 9:36:20.427779
2017/08/16