Python Date Time Calendar – Python Programming

Learn Python Programming from Basic to Advanced Concept with Examples. Learn Python DateTime, Time, Date, Calendar and Timezone.
Image by Michal Jarmoluk from Pixabay

Python Date Time can be used in Python by importing DateTime Modules. We can also work with Calendar using the Calendar Module.

Importing Date Time and Calendar Modules

import datetime
import calendar
Python Calendar Video Tutorial

Date function in python

Once we have imported modules then we can work on a date, time and calendar in Python

import datetime
x =

If you want specific Year, Month, Day then

x =


Create Date Time Object or Variable

For creating user-defined DateTime object use DateTime module name. For Example – 

y = datetime.datetime(2020,8,19)

Python Calendar

We can work with the calendar using the calendar module. For printing a specific month of the year. For Example:

cal = calendar.month(2017,2)

Whats Next – Python Function