summaryrefslogtreecommitdiffstats
path: root/Doc/library/datetime.rst
Commit message (Collapse)AuthorAgeFilesLines
* [doc] Fix missing commas in signatures (GH-23693)Miss Islington (bot)2020-12-291-2/+2
| | | | | | | | * Fix star in signatures * Fix comma in signatures (cherry picked from commit 60eccd095624f39195cc5ae0b49a59022bbbb028) Co-authored-by: Andre Delfino <adelfino@gmail.com>
* Reword aware/naive introduction sentence (GH-20175)Miss Islington (bot)2020-05-221-1/+2
| | | | | | | | This is more informative and avoids the question of whether the period should go inside or outside the quotation marks. See also GH-20007. (cherry picked from commit 2e76820a50b8ce2a9a5f6cdef6cef1859a89c460) Co-authored-by: Mathieu Dupuy <mathieu.dupuy@doctolib.com>
* Doc: move a dot outside double quotes (GH-20007)Miss Islington (bot)2020-05-171-1/+1
| | | | | (cherry picked from commit 4eba67783eb2084b2dad875ed1cbffdaf8a9202e) Co-authored-by: Mathieu Dupuy <mathieu.dupuy@doctolib.com>
* [typo] fix dupe in datetime.fromisoformat docs (GH-17295)Miss Islington (bot)2019-12-231-2/+0
| | | | | | | | | | | | Fixes a nearly word for word duplication of a sentence that appears earlier in the caution section of datetime.datetime.fromisoformat in Doc/Library/datetime.rst. No issue created as it's a trivial change. Automerge-Triggered-By: @pganssle (cherry picked from commit e7b406f4e20e248d24079f97d7c8b93e5a45249e) Co-authored-by: Michael Morehouse <640167+yawpitch@users.noreply.github.com>
* Add missing markup (GH-17680)Miss Islington (bot)2019-12-221-1/+1
| | | | | | "HH", "MM" and "ffffff" are enclosed with double back quotes, but "SS" is left being bare (cherry picked from commit 068768faf6b82478de239d7ab903dfb249ad96a4) Co-authored-by: cocoatomo <cocoatomo77@gmail.com>
* Fix typos (GH-17423)Miss Islington (bot)2019-12-011-2/+2
| | | | | (cherry picked from commit 575d0b46d122292ca6e0576a91265d7abf7cbc3d) Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
* bpo-37488 : Document a warning for datetime.utcnow() and utcfromtimestamp() ↵Miss Islington (bot)2019-09-121-16/+34
| | | | | | | | | | (GH-15773) https://bugs.python.org/issue37488 Automerge-Triggered-By: @pganssle (cherry picked from commit 1a53c785e62e00bad87ae19466c3a32ebcebb915) Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
* Overhaul datetime documentation (GH-13410)Miss Islington (bot)2019-09-121-476/+729
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a restructuring of the datetime documentation to hopefully make them more user-friendly and approachable to new users without losing any of the detail. Changes include: - Creating dedicated subsections for some concepts such as: - "Constants" - "Naive vs Aware" - "Determining if an Object is Aware" - Give 'naive vs aware' its own subsection - Give 'constants' their own subsection - Overhauling the strftime-strptime section by: - Breaking it into logical, linkable, and digestable parts - Adding a high-level comparison table - Moving the technical detail to bottom: readers come to this section primarily to remind themselves to things: - How do I write the format code for X? - strptime/strftime: which one is which again? - Touching up fromisoformat + isoformat sections by: - Revising fromisoformat + isoformat for date, time, and datetime - Adding basic examples - Enforcing consistency about putting formats (i.e. ``HH:MM``) in double backticks. This was previously done in some places but not all - Putting long 'supported formats', on their own line to improve readability - Moving the 'seealso' section to the top and add a link to dateutil Rationale: This doesn't really belong nested under the 'constants' section. Let readers know right away that datetime is one of several related tools. - Moving common features of several types into one place: Previously, each type went out of its way to note separately that it was hashable and picklable. These can be brought into one single place that is more prominent. - Reducing some verbose explanations to improve readability - Breaking up long paragraphs into digestable chunks - Displaying longer "equivalent to" examples, as short code blocks - Using the dot notation for datetime/time classes: Use :class:`.time` and :class:`.datetime` rather than :class:`time` and :class:`datetime`; otherwise, the generated links will route to the respective modules, not classes. - Rewording the tzinfo class description The top paragraph should get straight to the point of telling the reader what subclasses of tzinfo _do_. Previously, that was hidden in a later paragraph. - Adding a note on .today() versus .now() - Rearranging and expanding example blocks, including: - Moved long, multiline inline examples to standalone examples - Simplified the example block for timedelta arithmetic: - Broke the example into two logical sections: 1. normalization/parameter 'merging' 2. timedelta arithmetic - Reduced the complexity of the some of the examples. Show reasonable, real-world uses cases that are easy to follow along with and progres in difficult slightly. - Broke up the example sections for date and datetime sections by putting the easy examples first, progressing to more esoteric situations and breaking it up into logical sections based on what the methods are doing at a high level. - Simplified the KabulTz example: - Put the class definition itself into a non-REPL block since there is no interactive output involved there - Briefly explained what's happening before launching into the code - Broke the example section into visually separate chunks - Various whitespace, formatting, style and grammar fixes including: - Consistently using backctics for 'date_string' formats - Consistently using one space after periods. - Consistently using bold for vocab terms - Consistently using italics when referring to params: See https://devguide.python.org/documenting/GH-id4 - Using '::' to lead into code blocks Per https://devguide.python.org/documenting/GH-source-code, this will let the reader use the 'expand/collapse' top-right button for REPL blocks to hide or show the prompt. - Using consistent captialization schemes - Removing use of the default role - Put 'example' blocks in Markdown subsections This is a combination of 66 commits. See bpo-36960: https://bugs.python.org/issue36960 (cherry picked from commit 3fb1363fe87a24cdb2ee1dd9746f1c49046af958) Co-authored-by: Brad <brad.solomon.1124@gmail.com>
* bpo-37979: Add alternative to fromisoformat in documentation (GH-15596)Miss Islington (bot)2019-08-291-1/+3
| | | | | | | | | | | | | | | | Adds a link to `dateutil.parser.isoparse` in the documentation. It would be nice to set up intersphinx for things like this, but I think we can leave that for a separate PR. CC: @pitrou [bpo-37979](https://bugs.python.org/issue37979) https://bugs.python.org/issue37979 Automerge-Triggered-By: @pitrou (cherry picked from commit 59725f3badb3028636c8906ecac4ceb0a37f3982) Co-authored-by: Paul Ganssle <paul@ganssle.io>
* [3.8] Clarify argument types in datetime docs. (GH-15459) (GH-15472)Miss Islington (bot)2019-08-241-3/+3
| | | | | | | | | | | | | | | | | | "Arguments may be integers... " could be misunderstand as they also could be strings. New wording makes it clear that arguments have to be integers. modified: Doc/library/datetime.rst Automerge-Triggered-By: @pganssle (cherry picked from commit c5218fce02d6bd7bb343db20c8f14e8d9640783a) Co-authored-by: Jürgen Gmach <juergen.gmach@googlemail.com> Automerge-Triggered-By: @pganssle
* bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)Miss Islington (bot)2019-06-181-15/+20
| | | | | | | | | | For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional. This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true. bpo-34903 (cherry picked from commit 6b9c204ee77a0de87d6f51a3d4547a18604cef9e) Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
* bpo-30699: Improve example on datetime tzinfo instances (GH-4290)Mario Corchero2019-06-041-51/+60
| | | | | | | | | | | | | | | | | | | * Improve example on tzinfo instances Move from GMTX to TZX when naming the classes, as GMT1 might be rather confusing as seen in the reported issue. In addition, move to UTC over GMT and improve the tzname implementation. * Simplify datetime with tzinfo example Move the example in the documentation to just use timezone.utc and a user defined Kabul timezone rather than having two user defined timezones with DST. Kabul timezone is still interesting as it changes its offset but not based on DST. This is more accurate as the previous example was missing information about the fold attribute. Additionally, implementing the fold attribute was rather complex and probably not relevant enough for the section "datetime with tzinfo".
* bpo-19376: Added doc mentioning `datetime.strptime()` without a year fails ↵Abhishek Kumar Singh2019-05-181-0/+4
| | | | for Feb 29. (GH-10243)
* bpo-36004: Add date.fromisocalendar (GH-11888)Paul Ganssle2019-04-291-0/+17
| | | | This commit implements the first version of date.fromisocalendar, the inverse function for date.isocalendar.
* bpo-36138: Clarify docs about converting datetime.timedelta to scalars. ↵Yasser A2019-03-161-3/+5
| | | | | | (GH-12137) Be explicit that timedelta division converts an overall duration to the interval units given by the denominator.
* bpo-34512: Document platform-specific strftime() behavior for non-ASCII ↵Alexey Izbyshev2019-01-121-0/+6
| | | | format strings (GH-8948)
* bpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231)Serhiy Storchaka2018-10-311-3/+4
|
* bpo-27741: Better wording for datetime.strptime() (GH-9994)Gus Goulart2018-10-291-1/+3
|
* bpo-35054: Add yet more index entries for symbols. (GH-10121)Serhiy Storchaka2018-10-281-1/+1
|
* bpo-35054: Add more index entries for symbols. (GH-10064)Serhiy Storchaka2018-10-261-0/+3
|
* bpo-34158: Documentation UTC offset update (GH-8377)Christophe Nanteuil2018-10-051-20/+21
| | | | | | | | | | | | | | | | | | | | | * Documentation of UTC offset update Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update: - "%z" format code documentation update Karthikeyan Singaravelan commented on bugs.python.org: Added as part of 018d353c1c8c87767d2335cd884017c2ce12e045 and a fix regarding duplicate words for that part was added at bac2d5ba30339298db7d4caa9c8cd31d807cf081. Relevant format string at https://github.com/python/cpython/pull/2896/files#diff-25e2d173c84057d069b7890450714eddR214. Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/files#diff-acc40bec51c7de832de3361db3edae52R309. Table at https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column %z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030 - isoformat documentation update According to me, needs confirmation: Relevant format string at https://github.com/python/cpython/pull/4699/files#diff-25e2d173c84057d069b7890450714eddR176 Relevant test case at https://github.com/python/cpython/pull/4699/files#diff-25e2d173c84057d069b7890450714edd * From Martin Panter: some style improvment; From @pganssle: using f for fractional part of seconds in all file.
* bpo-34365: Update date object documentation (GH-8814)Danish Prakash2018-09-111-4/+3
| | | | | | | | Python 3.x does not fall back to comparing object addresses when comparing two `dt` objects. <!-- issue-number: [bpo-34365](https://www.bugs.python.org/issue34365) --> https://bugs.python.org/issue34365 <!-- /issue-number -->
* bpo-30516: Fix documentation issue with -timedelta in datetime (GH-7348)Farhaan Bukhsh2018-07-041-5/+6
| | | | | This commit fixes the -timedelta overfllow issue not documented properly. Signed-off-by: Farhaan Bukhsh <farhaan.bukhsh@gmail.com>
* bpo-33812: Corrected astimezone for naive datetimes. (GH-7578)Alexander Belopolsky2018-06-101-2/+1
| | | | | | | | | | | | | | | | | | | | A datetime object d is aware if d.tzinfo is not None and d.tzinfo.utcoffset(d) does not return None. If d.tzinfo is None, or if d.tzinfo is not None but d.tzinfo.utcoffset(d) returns None, d is naive. This commit ensures that instances with non-None d.tzinfo, but d.tzinfo.utcoffset(d) returning None are treated as naive. In addition, C acceleration code will raise TypeError if d.tzinfo.utcoffset(d) returns an object with the type other than timedelta. * Updated the documentation. Assume that the term "naive" is defined elsewhere and remove the not entirely correct clarification. Thanks, Tim.
* Fix duplicating words words. (GH-6296)Serhiy Storchaka2018-03-281-2/+2
| | | Most of them have been added in 3.7.
* bpo-15873: Implement [date][time].fromisoformat (#4699)Paul Ganssle2017-12-211-1/+47
| | | Closes bpo-15873.
* bpo-31545: Update documentation containing timedelta repr. (GH-3687)Utkarsh Upadhyay2017-10-271-6/+6
| | | | This is a fix to the documentation to reflect the changes merged in as part of bpo-30302.
* Closes bpo-31800: Support for colon when parsing time offsets (#4015)Mario Corchero2017-10-261-0/+7
| | | Add support to strptime to parse time offsets with a colon between the hour and the minutes.
* Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets. (#2896)Alexander Belopolsky2017-07-311-21/+49
| | | | | | | | | | | | | | | | | | * Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets. * bpo-5288: Implemented %z formatting of sub-minute offsets. * bpo-5288: Removed mentions of the whole minute limitation on TZ offsets. * bpo-5288: Removed one more mention of the whole minute limitation. Thanks @csabella! * Fix a formatting error in the docs * Addressed review comments. Thanks, @haypo.
* bpo-30302: Update WhatsNew and documentation. (#2929)Utkarsh Upadhyay2017-07-281-1/+1
| | | | | | * Update 'Porting to .37' section. * Fix a minor example in the doc.
* bpo-30302 Make timedelta.__repr__ more informative. (#1493)Utkarsh Upadhyay2017-07-251-3/+4
|
* bpo-30583: Fix typo in datetime dateutil documentation (GH-1972)wim glenn2017-06-061-2/+2
| | | Replace `datetuil` into `dateutil`
* Remove trailing semicolon in datetime doc example (GH-1653)delirious-lettuce2017-05-191-1/+1
|
* bpo-27200: Fix doctests in programming.rst and datetime.rst (#401)Marco Buttu2017-03-181-3/+7
|
* Issue #29078: Merge 3.5.Xiang Zhang2016-12-271-1/+1
|\
| * Issue #29078: Add the missing import in datetime.time doc example.Xiang Zhang2016-12-271-1/+1
| | | | | | | | Patch by Dhushyanth Ramasamy.
* | Issue #21818: Fixed references to classes that have names matching with moduleSerhiy Storchaka2016-12-021-3/+3
|\ \ | |/ | | | | names.
| * Issue #21818: Fixed references to classes that have names matching with moduleSerhiy Storchaka2016-12-021-3/+3
| | | | | | | | names.
* | Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
| |
* | Closes #27595: Document PEP 495 (Local Time Disambiguation) features.Alexander Belopolsky2016-08-241-42/+113
| |
* | Closes #27661: Added tzinfo keyword argument to datetime.combine.Alexander Belopolsky2016-08-021-5/+12
| |
* | Merge Issue #22558.Terry Jan Reedy2016-06-111-0/+3
|\ \ | |/
| * Issue #22558: Add remaining doc links to source code for Python-coded modules.Terry Jan Reedy2016-06-111-0/+3
| | | | | | | | | | Reformat header above separator line (added if missing) to a common format. Patch by Yoni Lavi.
* | Fix typos in datetime documentation.Berker Peksag2016-06-051-2/+2
| |
* | Issue #27076: More doc and comment spelling fixes for 3.6, by Ville SkyttäMartin Panter2016-05-261-1/+1
| |
* | Issue #26736: Used HTTPS for external links in the documentation if possible.Serhiy Storchaka2016-05-071-2/+2
|\ \ | |/
| * Issue #26736: Used HTTPS for external links in the documentation if possible.Serhiy Storchaka2016-05-071-2/+2
| |
* | Issue #26957: Remove duplicate 'the' from datetime documentationBerker Peksag2016-05-041-1/+1
|\ \ | |/ | | | | Patch by Alex Chan.
| * Issue #26957: Remove duplicate 'the' from datetime documentationBerker Peksag2016-05-041-1/+1
| | | | | | | | Patch by Alex Chan.
* | Issue #26678: Merge datetime doc fixes from 3.5Martin Panter2016-04-011-59/+63
|\ \ | |/