Skip to content

Commit 57b5baf

Browse files
miss-islingtonKentaroJayemmatyping
authored
[3.13] gh-133125: Clarify ZipInfo.date_time attribute documentation (GH-136082) (#138076)
gh-133125: Clarify ZipInfo.date_time attribute documentation (GH-136082) Specifically, clarify that ZipInfo.date_time pulls the datetime information from the central directory, and that times are interpreted as local time. (cherry picked from commit 282e885) Co-authored-by: Kentaro Jay Takahashi <64148935+KentaroJay@users.noreply.github.com> Co-authored-by: Emma Smith <emma@emmatyping.dev>
1 parent 2aeae24 commit 57b5baf

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Doc/library/zipfile.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,10 @@ Instances have the following methods and attributes:
799799
.. attribute:: ZipInfo.date_time
800800

801801
The time and date of the last modification to the archive member. This is a
802-
tuple of six values:
802+
tuple of six values representing the "last [modified] file time" and "last [modified] file date"
803+
fields from the ZIP file's central directory.
804+
805+
The tuple contains:
803806

804807
+-------+--------------------------+
805808
| Index | Value |
@@ -819,7 +822,15 @@ Instances have the following methods and attributes:
819822

820823
.. note::
821824

822-
The ZIP file format does not support timestamps before 1980.
825+
The ZIP format supports multiple timestamp fields in different locations
826+
(central directory, extra fields for NTFS/UNIX systems, etc.). This attribute
827+
specifically returns the timestamp from the central directory. The central
828+
directory timestamp format in ZIP files does not support timestamps before
829+
1980. While some extra field formats (such as UNIX timestamps) can represent
830+
earlier dates, this attribute only returns the central directory timestamp.
831+
832+
The central directory timestamp is interpreted as representing local
833+
time, rather than UTC time, to match the behavior of other zip tools.
823834

824835

825836
.. attribute:: ZipInfo.compress_type

0 commit comments

Comments
 (0)