I’m very new to Python, but I need to migrate a project from PHP to Python (running in GAE environment) and I need to move all data from one database to GAE’s one.
The chellenge is to write data strings into datetime objects.
Dates are stored as strings, which where created using PHP’s pattern “l dS of F Y ( h:i:s A )”
So every date looks like this:
Sunday 31st of July 2005 ( 02:05:50 PM )
I’ve looked into Python documentation on that, and I can see that datetime.strptime can do the job, but…
It has no parameter for “th”, “rd”, and “st” endings. And may have some other issues as well.
What could you advise me?
I can use RegExp and remove all unneccessary crap, or is there any way to create a datetime object from such a string directly?
Thank you in advance.
If you can use dateutil with GAE, then
Otherwise, you’ll have to rely on
reto manipulate the date string into a formatstrptimecan parse.