Web Analytics

Python datetime.date() Constructor

Date & Time Date Object

The datetime.date() class constructor is used to create a date object.

Syntax

datetime.date(year, month, day)

Parameters

Parameter Description
year Required. The year
month Required. The month (1-12)
day Required. The day (1-31)

Return Value

A date object.

Example

Using the datetime.date() constructor:

Output
Click Run to execute your code

Related Functions