datetime and strptime

Gerrit Holl gerrit at nl.linux.org
Sat Nov 15 15:27:15 EST 2003


Hi,

it seems the datetime library does not have a .strptime class method.
If I want to create a datetime object from a string, I currently have to do:

datetime.date(*time.strptime(s, "%Y%m%d")[:3])

If the format is more complex (not in the order of a timetuple), it is
even more complicated. In my opinion, it would be better to be able to do:

datetime.date.strptime(s, "%Y%m%d")

Is there a particular reason that this is not possible?
Or is the only reason that it hasn't been implemented?

yours,
Gerrit, who wanted to write a patch until he saw datetime is written in C.

-- 
233. If a builder build a house for some one, even though he has not
yet completed it; if then the walls seem toppling, the builder must make
the walls solid from his own means.
          -- 1780 BC, Hammurabi, Code of Law
-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Kom in verzet tegen dit kabinet:
	http://www.sp.nl/





More information about the Python-list mailing list