How to use time and date function in python ?
strftime() Method
913
06-Jul-2018
Updated on 06-Jul-2018
Prakash nidhi Verma
06-Jul-2018Python Date: in python data type are not created but we can import a module with dates as date objects in that sequence.Import datetime module and display current date:
The date having year, month, day, hour, minute, second, microsecond. The datetime module has many methods to return information about the date object. Return the year and name of weekday:
Creating Date Objects :
you can use the datetime() class (constructor) of the datetime module for creating a date. The datetime() class requires three parameters to create a date: year, month, day.
Create a date object:
The strftime() Method:
The datetime object has a method for formatting date objects into readable strings.
Display the name of the month: