Python program to print current year, month and day
In this article, the task is to write a Python Program to print the current year, month, and day.
- In Python, in order to print the current date consisting of a year, month, and day, it has a module named datetime. From the DateTime module, import date class
- Create an object of the date class
- Call the today( ) function of date class to fetch todays date.
- By using the object created, we can print the year, month, day(attribute of date class) of today.
Current date: 2020-12-10 Current year: 2020 Current month: 12 Current day: 10
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course