Skip to main content

http_date

Format the time to match the RFC 5322 date format as specified by RFC 9110 Section 5.6.7.

epoch_seconds is a floating point number expressed in seconds since the epoch, in UTC - such as that outputted by time.time(). If set to None, it defaults to the current time.

Output a string in the format 'Wdy, DD Mon YYYY HH:MM:SS GMT'.

def http_date(
epoch_seconds: float = None
) - > string

Format the time to match the RFC 5322 date format as specified by RFC 9110 Section 5.6.7.

Parameters

NameTypeDescription
epoch_secondsfloat = NoneA floating point number expressed in seconds since the epoch in UTC; defaults to the current time if not provided.

Returns

TypeDescription
stringA string in the format 'Wdy, DD Mon YYYY HH:MM:SS GMT', representing the timestamp in UTC.