Skip to main content

time_format

Format a datetime.time object using a localizable format.

If use_l10n is provided and is not None, it forces the value to be localized (or not), otherwise it's always localized.

def time_format(
value: datetime.time,
format: string = None,
use_l10n: boolean = None
) - > string

Format a datetime.time object using a localizable format. If use_l10n is provided and is not None, it forces the value to be localized (or not), otherwise it's always localized.

Parameters

NameTypeDescription
valuedatetime.timeThe time object to be formatted
formatstring = NoneThe specific format string or named format (e.g., 'TIME_FORMAT') to apply; defaults to the system's TIME_FORMAT if not provided
use_l10nboolean = NoneA flag to force or disable localization of the time format; if None, localization is enabled by default

Returns

TypeDescription
stringThe formatted time string based on the specified or localized format pattern