Lesson 17Working with Dates and Times
In previous lessons, you learned object-oriented programming (OOP) concepts. Remember that OOP is a way of structuring a program that allows properties, as well as behaviors, to be combined and reused in objects. Now that you understand this programming paradigm, let's take a look at how we can use those concepts as we process numeric/date-type data in Python.
Date and time are important concepts for any kind of computer work. We frequently need to timestamp activities as they are performed, aggregate data like sales volume based on time spans (such as hour, day, month, or year), and identify what activities have happened before other activities.
While humans generally treat dates and times as separate values, computers tend to treat any given second as a specific point in time, including the date as part of the entire value. Therefore, when we reference dates and times, we often need to split the value stored by a computer to get the specific value we need in a program. A few of the key concepts and terms you will encounter in this lesson include:
- Python's datetime module supplies classes for manipulating ...
Get Job Ready Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.