I had never worked with the datetime module in Python 2.3, and I have a very silly problem. I need to read a date in the format
'10-JUL-2010'
then subtract a day (I would use timedelta
), and return the string
'09-JUL-2010 00:00:00 ET'
of course, this is for hundreds of dates. While it should be trivial, I cannot find the info on how to read formatted dates in Python 2.3! Help!
Edit
I am able to retrieve the formatted date as a tuple, but it will not accept the timedelta
object for subtraction! Still working on it...
** Edit **
Finally... thanks to your help I was able to solve the problem as follows:
print (datetime(*(time.strptime(date_string, format)[0:6])).strftime('%d-%b-%Y')).upper()+'00:00:00 ET'