-
Dates and times are something every programmer eventually has to deal with. Python's implementation is fairly simple and simplifies these often tricky subjects.
What you'll learn
- Dates and times
- Timezones
- Converting between timezones
-
Dates and Times
Let's look at the datetime library and its datetime class. We'll also see how to manipulate these objects, turn them into strings, and more.
Chevron 11 steps-
Manipulating Time Already
6:50
-
now() and .replace()
4 objectives
-
Time Deltas
4:39
-
Timedeltas
4 questions
-
Far Away
1 objective
-
Today and Tomorrow
4:06
-
Timedelta Minute
1 objective
-
Dating Methods
7:28
-
strftime & strptime
2 objectives
-
Wikipedia Links
4:35
-
Time Tango
1 objective
Let's Build a Timed Quiz App
To make sure we understand datetimes and timedeltas, let's build a small app that'll time us answering math questions.
Chevron 6 steps-
The Question Classes & the Plan
7:09
-
Simple Time Machine
1 objective
-
The Quiz Class
7:38
-
Harder Time Machine
1 objective
-
Taking The Quiz
4:49
-
Timestamp Ordering
1 objective
-
Extra Credit
Expand the script so that:
- You can vary the number of questions
- You can change the range of numbers
- Add Subtraction questions
Where on Earth do Timezones Make Sense?
Timezones are often an amazingly confusing part of programming. Let's make them simpler using datetime and the pytz library.
Chevron 8 steps-
Introduction to Timezones
5:07
-
Timezone Maker
3 objectives
-
Datetime Awareness
2 objectives
-
Actually, Use pytz Instead
8:59
-
pytz Format
2 objectives
-
Timezonapalooza
7:52
-
Timezone Strings
1 objective
-
Review: Dates and Times in Python
6 questions
-