Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ca35ec

Browse files
Instructive example for strftime(); how to generate RFC822 dates.
1 parent d9b9ac8 commit 9ca35ec

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Doc/lib/libtime.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ \section{\module{time} ---
224224
seconds and the (very rare) double leap seconds.
225225
\end{description}
226226

227+
Here is an example, a format for dates compatible with that specified
228+
in the \rfc{822} Internet email standard.
229+
\footnote{The use of \%Z is now
230+
deprecated, but the \%z escape that expands to the preferred
231+
hour/minute offset is not supported by all ANSI C libraries. Also,
232+
a strict reading of the original 1982 \rfc{822} standard calls for
233+
a two-digit year (\%y rather than \%Y), but practice moved to
234+
4-digit years long before the year 2000.}
235+
236+
\begin{verbatim}
237+
>>> from time import *
238+
>>> strftime("\%a, \%d \%b \%Y \%H:\%M:\%S \%Z", localtime())
239+
'Sat, 27 Jan 2001 05:15:05 EST'
240+
>>>
241+
\end{verbatim}
242+
227243
Additional directives may be supported on certain platforms, but
228244
only the ones listed here have a meaning standardized by ANSI C.
229245

0 commit comments

Comments
 (0)