Date formats
Duncan Booth
duncan at NOSPAMrcp.co.uk
Fri Jun 14 05:07:31 EDT 2002
Max M <maxm at mxm.dk> wrote in news:3D09ABEB.4000209 at mxm.dk:
> Oh ... I cannot seem to find it in the docs. The closest I come is in:
>
> 2.2.6.2 String Formatting Operations
>
> where it says that:
>
> "# The value conversion will use the ``alternate form'' (where defined
> below)."
>
In 6.9, time:
"""Additional directives may be supported on certain platforms, but only
the ones listed here have a meaning standardized by ANSI C.
On some platforms, an optional field width and precision specification can
immediately follow the initial "%" of a directive in the following order;
this is also not portable. The field width is normally 2 except for %j
where it is 3"""
The meaning of the additional directives is not in the Python
documentation: I used MSDN for that. Microsoft's runtime doesn't support
field width and precision, but does use the # flag.
In case you didn't know, time.strftime calls the underlying C runtime
strftime with a buffer 256 times longer than the format string (since there
is no way to know how long a buffer is required).
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list