Python Date Time


Python Dates

A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects.

Example

Import the datetime module and display the current date:

import datetime

x = datetime.datetime.now()
print(x)
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.