converting string to a date format

tekion tekion at gmail.com
Mon Dec 21 14:37:14 EST 2009


Ben,
I do not have python 2.6 install, my version of Python is 2.4.
Because of my version of Python I believe I have to perform what you
have suggested:

This should, ideally, consist of two separate operations:

  * parse the string, using a specific format, to create a ‘datetime’
    object

  * create a string representation of the datetime using your
preferred
    string format

So I guess I am stuck on parsing the string "24/Nov/2009:12:00:00
-0500" using regex and or string function to get the output to
"2009-11-24 12:00:00".  It looks like I may have to use regex to
accomplish this and also re-map Nov to "11".  Does any one have any
idea that would take "24/Nov/2009:HH:MM:SS" and format it to
"2009-11-24 HH:MM:SS"? Thanks



More information about the Python-list mailing list