Times and dates
Carsten Gaebler
clpy at snakefarm.org
Thu Nov 7 11:07:31 EST 2002
YorizZ wrote:
> I know that i can create a string from a date with strtime(date), but not
> the other way around..
strptime() may be your friend if your platform supports it:
Python 2.2 (#1, Apr 12 2002, 15:29:57)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-109)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strptime("2002-11-07", "%Y-%m-%d")
(2002, 11, 7, 0, 0, 0, 3, 311, 0)
>>> time.asctime(time.strptime("2002-11-07", "%Y-%m-%d"))
'Thu Nov 7 00:00:00 2002'
>>>
cg.
More information about the Python-list
mailing list