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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.