strptime - dates formatted differently on different computers
noydb
jenn.duerr at gmail.com
Tue Dec 11 09:52:29 EST 2012
On Tuesday, December 11, 2012 3:35:29 AM UTC-5, Greg Donald wrote:
> On Mon, Dec 10, 2012 at 10:34:31PM -0700, Michael Torrie wrote:
>
> > I use a module I got from pypi called dateutil. It has a nice submodule
>
> > called parser that can handle a variety of date formats with good
>
> > accuracy. Not sure how it works, but it handles all the common American
>
> > date formats I've thrown at it.
>
>
>
> from dateutil.parser import parse
>
> dt = parse( whatever )
>
>
>
> I've throw all kind of date and timestamps at it.. have yet to see anything it won't parse.
>
>
>
>
>
> --
>
> Greg Donald
Thanks - I tried this (dateutil.parser import parsed...), and it works. I'm skeptical of it working for any crazy date string thrown at it, but for my purposes it should suffice -- and my purposes for now was purely just curiousity on how to handle if it became necessary.
I tried figuring out Steve D'Aprano's solution above on my system (windows 7, python 2.7) - no luck. Sorry, I am a newbie, so I'm a bit lost on this --- my locale module doesnt offer a nl_langinfo function -- why would this be?
More information about the Python-list
mailing list