The datetime.ctime()
method from datetime
module is used to convert data and time values into a string value.
The
datetime
module in Python is used to manipulate dates and times.
datetime.ctime()
It does not take any argument value.
String
: It returns a string containing date and time values.
In the example below, we are converting date= 2021, 11, 24
and date= 2022, 7, 12
to string values. Execute to see the output strings.
from datetime import date# demo date= 24/11/2021Str= date(2021, 11, 24).ctime()print("Value as string: ", Str)# demo date= 12/07/2021Str= date(2022, 7, 12).ctime()print("Value as string: ", Str)