Skip to main content

rfc2822_date

Converts a date or datetime object into an RFC 2822 formatted string using the email.utils.format_datetime utility.

def rfc2822_date(
date: datetime.date | datetime.datetime
) - > string

Converts a date or datetime object into a string formatted according to the RFC 2822 specification, commonly used in email headers.

Parameters

NameTypeDescription
date`datetime.datedatetime.datetime`

Returns

TypeDescription
stringThe formatted date string compliant with RFC 2822 standards.