The document is about Python's datetime module. It introduces the module and the key classes it contains for manipulating dates and times, including Date, Time, and DateTime objects. It shows how to create datetime objects from these classes, extract attributes like year and hour, and perform operations like adding or subtracting days to manipulate dates. Examples are provided demonstrating common datetime tasks in Python like printing dates in different formats, finding today's date, and comparing datetime objects.
In this document
Powered by AI
Introduction to Skillbrew and Pavan Verma, founder of P3 InfoTech. Focus on Python Programming Essentials.
Introduction to the datetime module, which includes key classes such as Date, Time, Datetime, Timedelta, and tzinfo.
Difference between naive objects (no timezone awareness) and aware objects (knowledge of time zones).
Note that all examples use naive objects.
Example demonstrating date object creation with output for year, month, day, and formatted date.
Example of creating a date object for today's date.
Example demonstrating time object creation with output for hour, minute, second, and formatted time.
Example of creating datetime objects with output for hour, minute, second, and formatted datetime.
Example of formatting and outputting a datetime object.
Example of adding 5 days to a datetime object and displaying the result.
Example of subtracting days to find a past date from a datetime object.
Example showing comparison of two datetime objects.
Example demonstrating subtraction of two datetime objects and outputting the time difference.
Recap of key topics covered: introduction to datetime module, types of datetime objects, and manipulation.
Links to additional resources for further reading on datetime objects in Python.