email.utils.format_datetime(dt, usegmt=False)
Like formatdate
, but the input is a datetime
instance. If it is a naive datetime, it is assumed to be “UTC with no information about the source timezone”, and the conventional -0000
is used for the timezone. If it is an aware datetime
, then the numeric timezone offset is used. If it is an aware timezone with offset zero, then usegmt may be set to True
, in which case the string GMT
is used instead of the numeric timezone offset. This provides a way to generate standards conformant HTTP date headers.
New in version 3.3.
Please login to continue.