Method Name:
date
Method Signature:
date()
Method Overview:
- The date() instance method of the python datetime class returns a date instance.
- Using this method only the date information excluding the time information is retrieved from a datetime instance.
Example:
| import datetime 
 # Create a datetime instance datetimeInstance = datetime.datetime.today() 
 # Get only the date instance from datetime instance dateInstance = datetimeInstance.date() 
 # Print the datetime instance print(datetimeInstance) 
 # Print the date instance print(dateInstance) | 
Output:
| 2017-02-13 18:30:22.303811 2017-02-13 |