In the below example – we are implementing a python program to print the current/ today's year, month and year.
Steps:
- Import the date class from datetime module
- Create a date object of today's date – call the today() function of date class to get the current date.
- By using the date object – we can extract and print today's year, month and day.