Python - datetime

From PeformIQ Upgrade
Revision as of 09:56, 16 April 2008 by PeterHarding (talk | contribs)
Jump to navigation Jump to search

Examples

#!/usr/bin/env python

import datetime

start_date = datetime.datetime(2007,01,01)
end_date   = datetime.datetime(2008,03,11)

print start_date
print end_date

date = start_date

print 'Date'

while date < end_date:
   print date.strftime('%Y-%m-%d')

   date += datetime.timedelta(days=1)