summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libtime.tex
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-01-28 00:56:54 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2001-01-28 00:56:54 (GMT)
commit9ca35ec97ae5b2d42da21c75fa2d082409892c10 (patch)
tree9859192f96ba28e8a1de3eec895ad64bfd3fc85e /Doc/lib/libtime.tex
parentd9b9ac855c6bb297e7d5549e0d140ff7f48ebee6 (diff)
downloadcpython-9ca35ec97ae5b2d42da21c75fa2d082409892c10.zip
cpython-9ca35ec97ae5b2d42da21c75fa2d082409892c10.tar.gz
cpython-9ca35ec97ae5b2d42da21c75fa2d082409892c10.tar.bz2
Instructive example for strftime(); how to generate RFC822 dates.
Diffstat (limited to 'Doc/lib/libtime.tex')
-rw-r--r--Doc/lib/libtime.tex16
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/lib/libtime.tex b/Doc/lib/libtime.tex
index 68166d2..8ff36ed 100644
--- a/Doc/lib/libtime.tex
+++ b/Doc/lib/libtime.tex
@@ -224,6 +224,22 @@ Notes:
seconds and the (very rare) double leap seconds.
\end{description}
+Here is an example, a format for dates compatible with that specified
+in the \rfc{822} Internet email standard.
+ \footnote{The use of \%Z is now
+ deprecated, but the \%z escape that expands to the preferred
+ hour/minute offset is not supported by all ANSI C libraries. Also,
+ a strict reading of the original 1982 \rfc{822} standard calls for
+ a two-digit year (\%y rather than \%Y), but practice moved to
+ 4-digit years long before the year 2000.}
+
+\begin{verbatim}
+>>> from time import *
+>>> strftime("\%a, \%d \%b \%Y \%H:\%M:\%S \%Z", localtime())
+'Sat, 27 Jan 2001 05:15:05 EST'
+>>>
+\end{verbatim}
+
Additional directives may be supported on certain platforms, but
only the ones listed here have a meaning standardized by ANSI C.