REST Auth API: Date & Time Formats
DateTime values
API usage
DateTime properties are used only for the CreatedDateTime
and LastModifiedDateTime
audit properties on resources
such as Contacts, Organisations, Venues, Registrations and Events. All other properties involving representation of dates and times use DateTimeOffset values.
Representation
DateTime values are expressed as normalized UTC values in the format yyyy-mm-ddThh:mm[:ss[.fff]]Z
.
- Values are always expressed in UTC (equivalent to an offset of +00:00).
- The timezone designator is always
Z
. - The hours component must be specified as two digits in 24-hour format.
-
When used in filter queries, the
:ss
seconds and.fff
fractional seconds components are optional and may be expressed up to 3 decimal places of precision.
For example, the date 30 Dec 2001 9:30:00AM UTC is formatted as 2001-12-30T09:30:00Z
.
Use in expressions
To include a DateTime literal string in collection filter expressions, the value must be expressed using datetime('literal')
cast syntax. For example:
?filter=LastModifiedDateTime gt datetime('2010-03-23T09:25:12.313Z')
When using DateTime values in collection filter expressions, ensure any local time is converted to UTC first before formatting it for use in an expression.
DateTimeOffset values
API usage
DateTimeOffset properties are used for StartDateTime
and FinishDateTime
properties on resources
such as Events, EventSessions.
Representation
DateTimeOffset values are expressed as in the format yyyy-mm-ddThh:mm[:ss[.fff]]zzzz
.
-
The offset component is expressed in the format
+|-hh:mm
. For example,+12:00
or-09:30
. - The hours component must be specified as two digits in 24-hour format.
-
When used in filter queries, the
:ss
seconds and.fff
fractional seconds components are optional and may be expressed up to 3 decimal places of precision.
For example, the date 30 Dec 2001 9:30:00AM +1200 is formatted as 2001-12-30T09:30:00+12:00
.
Use in expressions
To include a DateTimeOffset literal string in collection filter expressions, the value must be expressed using datetimeoffset('literal')
cast syntax. For example:
?filter=StartDateTime gt datetimeoffset('2009-07-22T12:00:00.000+12:00')
Note the '+
' character in the querystring above must be escaped for correct parsing, but it has been left unescaped for readability in this example.