strtotime?
Gerrit Holl
gerrit at nl.linux.org
Fri Jan 23 07:20:27 EST 2004
Peter Hansen wrote:
> Leif K-Brooks wrote:
> > Irmen de Jong wrote:
> > >> PHP has a very nice strtotime function (http://php.net/strtotime)
> > >> which converts a date/time in virtually any format into a timestamp.
> > >> Does Python have a similar function?
> > >
> > > I guess you're looking for: time.strptime
> >
> > Thanks, but no. PHP's strtotime() function magically guesses the format
> > on its own, time.strptime() just uses a fixed format.
>
> Perhaps the mx.DateTime package would help:
Or DateUtil:
https://moin.conectiva.com.br/DateUtil
>>> parse("3rd of May 2001")
datetime.datetime(2001, 5, 3, 0, 0)
yours,
Gerrit.
--
6. If any one steal the property of a temple or of the court, he shall
be put to death, and also the one who receives the stolen thing from him
shall be put to death.
-- 1780 BC, Hammurabi, Code of Law
--
PrePEP: Builtin path type
http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/
More information about the Python-list
mailing list