[Tutor] time.strptime in Active State Python 2.1

Allan Crooks allan.crooks@btinternet.com
Tue, 12 Jun 2001 03:21:28 +0100


> I know about the STRFTIME function, but according to Python Ess. Ref, 
> there's also a STRPTIME function.  Maybe it was in 1.5.2 and it's gone in 2.1.

Sorry, I actually bothered to look at the time documentation in this time. :)

It's very rare that they would remove a function from a module.

The good news is strptime still exists. The bad news is, it's only available on "most Unix systems".

Take a look for yourself at: http://www.python.org/doc/current/lib/module-time.html

> If that's the case, how do I go about taking a string representinig a 
> certain time and turn it into a tuple  of the same form as returned by 
> LOCALTIME?

Ahh. Well, it's not provided in standard python, so you have to use modules elsewhere.

I've had a look for you, and this one might be of use:

http://www.fukt.hk-r.se/~flognat/hacks/strptime.py

HTH,
Allan.