datetime — Basic date and time types — Python 3.14.2 documentation#datetime.time.strptime

method classtime.strptime(date_string, format)

Return a time corresponding to date_string, parsed according to format.

If format does not contain microseconds or timezone information, this is equivalent to:

time(﹡(time.strptime(date_string, format)[3:6]))

ValueError is raised if the date_string and format cannot be parsed by time.strptime() or if it returns a value which is not a time tuple. See also strftime() and strptime() behavior and time.fromisoformat().

Added in version 3.14.

Instance methods:

Printed 2026-06-28.

(echo:: @ )