|
| https://realpython.com/ |
| Start Here | https://realpython.com/start-here/ |
|
Learn Python
| https://realpython.com/lessons/python-datetime-summary/ |
| Python Tutorials →In-depth articles and video courses | https://realpython.com/search?kind=article&kind=course&order=newest |
| Learning Paths →Guided study plans for accelerated learning | https://realpython.com/learning-paths/ |
| Quizzes & Exercises →Check your learning progress | https://realpython.com/quizzes/ |
| Browse Topics →Focus on a specific area or skill level | https://realpython.com/tutorials/all/ |
| Community Chat →Learn with other Pythonistas | https://realpython.com/community/ |
| Office Hours →Live Q&A calls with Python experts | https://realpython.com/office-hours/ |
| Podcast →Hear what’s new in the world of Python | https://realpython.com/podcasts/rpp/ |
| Books →Round out your knowledge and learn offline | https://realpython.com/products/books/ |
| Reference →Concise definitions for common Python terms | https://realpython.com/ref/ |
| Code Mentor →BetaPersonalized code assistance & learning tools | https://realpython.com/mentor/ |
| Unlock All Content → | https://realpython.com/account/join/ |
|
More
| https://realpython.com/lessons/python-datetime-summary/ |
| Learner Stories | https://realpython.com/learner-stories/ |
| Python Newsletter | https://realpython.com/newsletter/ |
| Python Job Board | https://www.pythonjobshq.com |
| Meet the Team | https://realpython.com/team/ |
| Become a Tutorial Writer | https://realpython.com/write-for-us/ |
| Become a Video Instructor | https://realpython.com/become-an-instructor/ |
| Search | https://realpython.com/search |
| https://realpython.com/search |
| Join | https://realpython.com/account/join/ |
| Sign‑In | https://realpython.com/account/login/?next=%2Flessons%2Fpython-datetime-summary%2F |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-datetime-module |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-datetime-module |
| https://realpython.com/courses/python-datetime-module/#team |
| Using Python's datetime Module | https://realpython.com/courses/python-datetime-module/ |
| Christopher Trudeau | https://realpython.com/courses/python-datetime-module/#team |
| Recommended Tutorial | https://realpython.com/python-datetime/ |
| Course Slides (.pdf) | https://realpython.com/courses/python-datetime-module/downloads/python-datetime-module-slides/ |
| Sample Code (.zip) | https://realpython.com/courses/python-datetime-module/downloads/python-datetime-module-sample-code/ |
| Ask a Question | https://realpython.com/lessons/python-datetime-summary/#discussion |
| https://realpython.com/feedback/survey/course/python-datetime-module/liked/?from=lesson-title |
| https://realpython.com/feedback/survey/course/python-datetime-module/disliked/?from=lesson-title |
| Contents | https://realpython.com/lessons/python-datetime-summary/#description |
| Transcript | https://realpython.com/lessons/python-datetime-summary/#transcript |
| Discussion (6) | https://realpython.com/lessons/python-datetime-summary/#discussion |
| Your Calendar Fallacy Is… | https://yourcalendricalfallacyis.com/ |
| Stackoverflow: Daylight saving time and time zone best practices | https://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practices/2532962#2532962 |
| Storing UTC Is Not A Silver Bullet | https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/ |
| The Complexity of Time Data Programming | https://www.mojotech.com/blog/the-complexity-of-time-data-programming/ |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-datetime-module |
| Sign-In | https://realpython.com/account/login/ |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-datetime-module |
| Sign-In | https://realpython.com/account/login/ |
| 00:00 | https://realpython.com/lessons/python-datetime-summary/#t=0.51 |
| In the previous lesson, | https://realpython.com/lessons/python-datetime-summary/#t=0.51 |
| I showed you how to find the differences between datetime objects. | https://realpython.com/lessons/python-datetime-summary/#t=1.47 |
| This lesson summarizes the course and points you at some further information. | https://realpython.com/lessons/python-datetime-summary/#t=5.37 |
| 00:11 | https://realpython.com/lessons/python-datetime-summary/#t=11.44 |
| I started out with the warning of how messy dates and times can be | https://realpython.com/lessons/python-datetime-summary/#t=11.44 |
| and then showed you how to use four different Python standard libraries for date | https://realpython.com/lessons/python-datetime-summary/#t=15.28 |
| and time objects: time, datetime, zoneinfo, | https://realpython.com/lessons/python-datetime-summary/#t=19.15 |
| and timedelta. As the timedelta class is a bit limited, | https://realpython.com/lessons/python-datetime-summary/#t=24.49 |
| I showed you the dateutil package as a possible augment. | https://realpython.com/lessons/python-datetime-summary/#t=29.35 |
| 00:34 | https://realpython.com/lessons/python-datetime-summary/#t=34.87 |
| And throughout the course, | https://realpython.com/lessons/python-datetime-summary/#t=34.87 |
| I added to a script that calculates how much time has passed since the last | https://realpython.com/lessons/python-datetime-summary/#t=35.86 |
| apocalypse. | https://realpython.com/lessons/python-datetime-summary/#t=39.76 |
| 00:42 | https://realpython.com/lessons/python-datetime-summary/#t=42.65 |
| In the description below, I’ve included several different articles about the | https://realpython.com/lessons/python-datetime-summary/#t=42.65 |
| messiness which is working with dates and times. Your Calendar Fallacy is | https://realpython.com/lessons/python-datetime-summary/#t=45.95 |
| a long list of things that people often think are true about dates, | https://realpython.com/lessons/python-datetime-summary/#t=50.54 |
| and as you might guess from the title, well, | https://realpython.com/lessons/python-datetime-summary/#t=54.56 |
| they’re not. This Stackoverflow discussion has an excellent | https://realpython.com/lessons/python-datetime-summary/#t=56.72 |
| answer | https://realpython.com/lessons/python-datetime-summary/#t=61.19 |
| summarizing a lot of the best practices with daylight savings and time zones. | https://realpython.com/lessons/python-datetime-summary/#t=61.82 |
| 01:07 | https://realpython.com/lessons/python-datetime-summary/#t=67.52 |
| In the overview, | https://realpython.com/lessons/python-datetime-summary/#t=67.52 |
| I hinted that the Let’s use UTC to store things solution | https://realpython.com/lessons/python-datetime-summary/#t=68.48 |
| isn’t always the right one. This article talks about some of the edge cases … | https://realpython.com/lessons/python-datetime-summary/#t=72.77 |
| and this is another perspective on the same topic. | https://realpython.com/lessons/python-datetime-summary/#t=78.44 |
| 01:22 | https://realpython.com/lessons/python-datetime-summary/#t=82.76 |
| This YouTube video from Computerphile covers a lot of similar topics | https://realpython.com/lessons/python-datetime-summary/#t=82.76 |
| if you’d rather watch than read. | https://realpython.com/lessons/python-datetime-summary/#t=86.72 |
| And finally, a comprehensive article on all this messiness. | https://realpython.com/lessons/python-datetime-summary/#t=89.96 |
| 01:35 | https://realpython.com/lessons/python-datetime-summary/#t=95.83 |
| Because Python’s date/time libraries are a little lightweight, | https://realpython.com/lessons/python-datetime-summary/#t=95.83 |
| there are loads of third-party libraries out there to compensate. Links to these | https://realpython.com/lessons/python-datetime-summary/#t=98.77 |
| projects are in the description below. pytz was the solution to | https://realpython.com/lessons/python-datetime-summary/#t=102.85 |
| time zones in Python before zoneinfo existed. | https://realpython.com/lessons/python-datetime-summary/#t=107.8 |
| 01:51 | https://realpython.com/lessons/python-datetime-summary/#t=111.82 |
| I’d suggest using the standard-library solution instead, | https://realpython.com/lessons/python-datetime-summary/#t=111.82 |
| but this one is definitely still out there in the wild, | https://realpython.com/lessons/python-datetime-summary/#t=114.79 |
| so you might want to be familiar with it. Now, | https://realpython.com/lessons/python-datetime-summary/#t=117.73 |
| here are three different drop-in replacements for datetime. | https://realpython.com/lessons/python-datetime-summary/#t=121.45 |
| 02:04 | https://realpython.com/lessons/python-datetime-summary/#t=124.78 |
| They provide compatible methods as well as all sorts of other capabilities. | https://realpython.com/lessons/python-datetime-summary/#t=124.78 |
| Arrow, Pendulum, and interestingly enough, Maya. | https://realpython.com/lessons/python-datetime-summary/#t=130.0 |
| 02:16 | https://realpython.com/lessons/python-datetime-summary/#t=136.36 |
| In a previous lesson, | https://realpython.com/lessons/python-datetime-summary/#t=136.36 |
| I mentioned dateparser, used to parse human-readable time concepts, like tomorrow, | https://realpython.com/lessons/python-datetime-summary/#t=137.29 |
| and having some of my childhood overlapping with the eighties, | https://realpython.com/lessons/python-datetime-summary/#t=143.23 |
| the name of this module always just makes me smile. | https://realpython.com/lessons/python-datetime-summary/#t=146.53 |
| 02:29 | https://realpython.com/lessons/python-datetime-summary/#t=149.56 |
| This one, Delorean, mixes the human-readable concepts of dateparser with the time | https://realpython.com/lessons/python-datetime-summary/#t=149.56 |
| delta concepts of dateutil. | https://realpython.com/lessons/python-datetime-summary/#t=154.0 |
| Finally, pywhen. Full disclosure: this is one of mine. | https://realpython.com/lessons/python-datetime-summary/#t=155.53 |
| 02:40 | https://realpython.com/lessons/python-datetime-summary/#t=160.66 |
| It’s a very lightweight library that just wraps the construction of datetime | https://realpython.com/lessons/python-datetime-summary/#t=160.66 |
| objects. | https://realpython.com/lessons/python-datetime-summary/#t=164.35 |
| I was doing some work a while back where fractional sections and Unix epochs were | https://realpython.com/lessons/python-datetime-summary/#t=165.46 |
| important and found nothing else did what I needed. So I threw this together. | https://realpython.com/lessons/python-datetime-summary/#t=169.45 |
| 02:56 | https://realpython.com/lessons/python-datetime-summary/#t=176.08 |
| Thanks for your attention. I hope you had a good time. See what I did there? | https://realpython.com/lessons/python-datetime-summary/#t=176.08 |
| Dad joke for the win. | https://realpython.com/lessons/python-datetime-summary/#t=181.42 |
| May 24, 2022 | https://realpython.com/lessons/python-datetime-summary/#comment-414e5231-aa99-4197-bae7-700f5c7f3bb5 |
| May 24, 2022 | https://realpython.com/lessons/python-datetime-summary/#comment-bf5cc0ca-57e5-41df-8b93-add03de0e10b |
| July 11, 2022 | https://realpython.com/lessons/python-datetime-summary/#comment-e86336f1-aca8-4ba4-9618-bc8ef74cc8a9 |
| July 12, 2022 | https://realpython.com/lessons/python-datetime-summary/#comment-21548bf0-1673-42f8-96a8-14d931a796f6 |
| Aug. 29, 2022 | https://realpython.com/lessons/python-datetime-summary/#comment-46c25bcc-1674-403e-bcb6-b07f078e87f0 |
| May 1, 2023 | https://realpython.com/lessons/python-datetime-summary/#comment-b4106ac3-a4d0-4ebd-b314-13ddc654a765 |
| docs.python.org/3/library/zoneinfo.html#data-sources | https://docs.python.org/3/library/zoneinfo.html#data-sources |
| Become a Member | https://realpython.com/account/join/ |
| https://realpython.com/lessons/date-time-arithmetic/ |
| Overview | https://realpython.com/courses/python-datetime-module/ |
|
Using Python's datetime Module (Overview) 02:37
| https://realpython.com/videos/python-datetime-module-overview/ |
|
Understanding That Dates and Times Are Messy 07:33
| https://realpython.com/videos/messy-date-time/ |
|
Introducing datetime 06:13
| https://realpython.com/lessons/introducing-datetime/ |
|
Dealing With Time Zones 10:44
| https://realpython.com/lessons/dealing-with-time-zones/ |
|
Doing Date and Time Arithmetic 05:48
| https://realpython.com/lessons/date-time-arithmetic/ |
|
Using Python's datetime Module (Summary) 03:04
| https://realpython.com/lessons/python-datetime-summary/ |
| Privacy Policy | https://realpython.com/privacy-policy/ |
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover