Python Date - Class Level Attribute

List of class level attributes defined in datetime.date:

Attribute Name

Description

date.min

Is the minimum date supported in Python.

date.max

Is the maximum date supported in Python

date.resolution

Is the minimum resolution between two dates of different values

 

Example:

import datetime

 

# print supported minimum date

minDate = datetime.date.min

print("Supported minimum date in Python is {}".format(minDate))

 

# print supported maximum date

maxDate = datetime.date.max

print("Supported maximum date in Python is {}".format(maxDate))

 

# Minimum resolution between two dates in Python

minResolution = datetime.date.resolution

print("Minimum resolution between two dates in Python is {}".format(minResolution))

 

 

Output:

Supported minimum date in Python is 0001-01-01

Supported maximum date in Python is 9999-12-31

Minimum resolution between two dates in Python is 1 day, 0:00:00

 


Copyright 2023 © pythontic.com