Robert Rawlins - Think Blue <robert.rawlins <at> thinkbluemedia.co.uk> writes:
> I’ve tried using the time.strptime() function without much success so > thought I’d come and ask your advice. > How exactly does it not work?? This works for me: from time import mktime, strptime from datetime import datetime datetime_string = '2007-02-01 00:00:00' datetime_object = datetime.fromtimestamp( mktime(strptime(datetime_string,'%Y-%m-%d %H:%M:%S'))) print datetime_object.year print datetime_object.month print datetime_object.day print datetime_object.hour print datetime_object.minute print datetime_object.second HTH, Dave -- http://mail.python.org/mailman/listinfo/python-list