Date and Time Formatting

Format dates and times for the SP-API.

The Selling Partner API (SP-API) formats dates and times similarly to the RFC 3339 standard, which defines a subset profile of ISO 8601 for use in internet protocols and standards. This section clarifies how to format and use dates and times in the SP-API.

Type DateTime

Date and time data is expressed as Gregorian calendar dates (year, month, day) and 24-hour time. No truncated formats are allowed. All date and time data is expressed numerically with leading zeros preserved.

DateTime string patterns are yyyy-MM-ddTHH:mm:ss.sssZ (for UTC) or yyyy-MM-ddTHH:mm:ss.sss±hh:mm (for a local time offset). The character T is a required delimiter between the date and time sections. The colon (:) is used as a delimiter between hours, minutes, and seconds. Fractional seconds are expressed with a decimal mark (. or ,) when needed.

Type conflicts

All use of date and time data in SP-API should be expressed as type DateTime. However, there are a few parameters that express date or time as a simple string. Check the parameter type definition to be sure of which type to use. Using the wrong type will generate an error.

Time intervals

While time intervals and durations are allowed with ISO 8601, they are not currently used in SP-API.

Example:

2016-03-16T14:32:16.50-07

This example is read as the 16th day of March in 2016 at 14 hours, 32 minutes, and 16.50 seconds local time. The local time is seven hours behind UTC.

For more information