New Time format

Dale Strickland-Clark dale at
Thu Jan 24 14:11:03 EST 2002

Pretty please can we have a new format method in the time module?

There is an ISO standard date format, the order of which makes sense
in most regions: year-month-day hour:minutes:seconds

I propose:


returns a strings the contents of which are determined by style.

style = 0 => "hh:mm:ss"
style = 1 => "yyyy-mm-dd"               (all numeric)
style = 2 => "yyyy-mmm-dd"              (month localised TLA)
style = 3 => "yyyy-mm-dd hh:mm:ss"      (all numeric)
style = 4 => "yyyy-mmm-dd hh:mm:ss"     (month localised TLA)

This would be a convenient format for use in output statements where
you need the date but aren't too fussed about the appearance, so long
as it isn't in the verbose confused order of time.asctime(). The guy
who devised that format was on some disturbing medication. I hope he's
feeling better now.

What I'm after is something I can stick in code when I need a
date/time without having to check the docs for the correct formatting

Dale Strickland-Clark
Riverhall Systems Ltd

More information about the Python-list mailing list