Today() Function Of Class In Python

Function Name:


Function Signature:

@classmethod today()

Return Value:

Returns the current local date.

Function Overview:

  • The method today() of the date class, returns the current local date. By local it means the system and its current time settings used. 
  • To construct the date, the function makes use of the current time.
  • Note that the a class method. Hence, it can be called using the class name date itself, rather using an instance of date class.



import datetime

import time


# Using

todaysDate =;

print("Today's date - Using date class:%s"%todaysDate);


# Using date.fromtimestamp()

todaysDate =;

print("Today's date - Using time class:%s"%todaysDate);



Today's date - Using date class:2019-07-11

Today's date - Using time class:2019-07-11

Copyright 2020 ©