The strptime() function is a method to format and can return a string representation of date and time. It uses date and time as input to give the result using the input as per the instructions. Syntax - time.strptime(date_time_srting,directive)