Home »
Python »
Python programs
Python program to get current date
Here, in this program, we are going to learn how to get the current system date using Python? This is an example of Python datetime module.
Submitted by IncludeHelp, on March 09, 2020
In the below example – we are implementing a python program to get the current date.
Steps:
- Import the date class from datetime module.
- Call today() function which is a library function of date class.
- Finally, print the date.
# Python program to get current date
# importing the date class
# from datetime module
from datetime import date
# getting the current date
current_date = date.today()
# printing the date
print("Current date is: ", current_date)
Output
Current date is: 2020-03-09
ADVERTISEMENT
ADVERTISEMENT