Skip to main content

rfc3339_date

Converts a date or datetime object into an RFC 3339 compliant string, appending a UTC designator if no timezone offset is present.

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

Converts a date or datetime object into a string formatted according to the RFC 3339 standard, ensuring compatibility with systems requiring standardized timestamp representations.

Parameters

NameTypeDescription
date`datetime.datedatetime.datetime`

Returns

TypeDescription
stringThe ISO 8601 formatted date string with a 'Z' suffix if no UTC offset is present, representing the timestamp in RFC 3339 format.