]> granicus.if.org Git - python/commitdiff
Issue #17701: Improving strftime documentation
authorDavid Wolever <david@wolever.net>
Mon, 12 Aug 2013 19:50:10 +0000 (15:50 -0400)
committerDavid Wolever <david@wolever.net>
Mon, 12 Aug 2013 19:50:10 +0000 (15:50 -0400)
1  2 
Doc/library/datetime.rst
Misc/NEWS

index 7219cea64574ad57db67d7329b483dc051550e49,e33f3f06ba1976c2917bbba37ddbebde082722d5..be41e1210db79dcd31a814e160aed55e908564b0
@@@ -1737,12 -1736,35 +1736,35 @@@ Notes
     produce them in :func:`strftime` output.
  
  (4)
-    When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used in
-    calculations when the day of the week and the year are specified.
+    ``%f`` is an extension to the set of format characters in the C standard
+    (but implemented separately in datetime objects, and therefore always
+    available).  When used with the :meth:`strptime` method, the ``%f``
 -   directive accepts from one to six digits and zero pads on the right.  
++   directive accepts from one to six digits and zero pads on the right.
+    .. versionadded:: 2.6
  
  (5)
-    For example, if :meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``,
-    ``%z`` is replaced with the string ``'-0330'``.
+    For a naive object, the ``%z`` and ``%Z`` format codes are replaced by empty
+    strings.
+    For an aware object:
+    ``%z``
+       :meth:`utcoffset` is transformed into a 5-character string of the form
+       +HHMM or -HHMM, where HH is a 2-digit string giving the number of UTC
+       offset hours, and MM is a 2-digit string giving the number of UTC offset
+       minutes.  For example, if :meth:`utcoffset` returns
+       ``timedelta(hours=-3, minutes=-30)``, ``%z`` is replaced with the string
+       ``'-0330'``.
+    ``%Z``
+       If :meth:`tzname` returns ``None``, ``%Z`` is replaced by an empty
+       string.  Otherwise ``%Z`` is replaced by the returned value, which must
+       be a string.
+ (6)
+    When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used
+    in calculations when the day of the week and the year are specified.
  
  
  .. rubric:: Footnotes
diff --cc Misc/NEWS
index c9b7fdc6d2559f341a058d1ab6e734550e34a3cb,9c472ddbf9f999c33741b6182c25d2bb9971df69..5e4a1bee3c65e70f669622444639097197306025
+++ b/Misc/NEWS
@@@ -164,6 -39,6 +164,7 @@@ Test
  Documentation
  -------------
  
++- Issue #17701: Improving strftime documentation.
  - Issue #17844: Refactor a documentation of Python specific encodings.
    Add links to encoders and decoders for binary-to-binary codecs.