Python Time asctime() Method

The asctime() method turns a tuple or struct time representing a time provided by gmtime() or localtime() into a 24-character text of the type 'Mon May 23 20:22:05 2022'.

Example of asctime() Method

Day Mon Date Hour:Min:Sec Year

For example:

Thu 05 22 09:50:43 2022

Syntax of asctime()

This is the syntax for asctime() method

Parameters

t is a nine-element tuple or struct_time that represents a time as returned by the gmtime() or localtime() functions.

Return Value

This function gives 24-character string of the form - 'Mon May 23 20:22:05 2022'.

Code

The Output of the above example code is:

time.asctime(t): Mon May  9 22:37:07 2022 





Latest Courses