time.strftime()

time.strftime(format[, tuple]) → string

Convert a time tuple to a string according to a format specification. See the library reference manual for formatting codes. When the time tuple is not present, current time as returned by localtime() is used.