×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

How to get current date in Python?

Python | Get current date: In this tutorial, we will learn how to get the current date using Python program? By IncludeHelp Last updated : December 28, 2023

In the below example – we are implementing a python program to get the current date.

Getting current date in Python

To get the current date, you can use the today() method of datetime module, this module provides classes for getting, creating, and manipulating dates and times.

Steps to get current date

  • Import the date class from datetime module.
    from datetime import date
  • Call today() function which is a library function of date class.
    current_date = date.today()
  • Finally, print the date.
    print("Current date is: ", current_date)
    

Python program to get current date

# How to get current date in Python? 

# 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

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.