jonas at jonasgalvez.com
Wed Apr 21 21:40:56 CEST 2004
> [Mike Fletcher]
> That format is the ISO standard date-time format. The modern way
> to work with date-times in Python is to use the datetime module,
> >>> import datetime
> >>> d = datetime.datetime( 2004, 4, 21, 15, 05)
> >>> d.isoformat()
> You can use datetime.datetime( * mytuple ) to auto-unpack your
> tuple, btw.
Cool, that's what I was looking for.
> [Peter Hansen]
> You want to read about the "time" module:
> >>> t = (2004, 4, 21, 15, 33)
> >>> import time
> >>> time.strftime('%Y-%m-%dT%H:%M:00', t+(0,0,0,0))
> I left the "T" in there as a literal because I don't know what you
> meant it to be and there's no obvious single-character
The "T" is from the W3C format:
I need it to generate valid RSS/ATOM feeds.
More information about the Python-list