Dates

When it comes to working with dates with the API, here are a few things to keep in mind.

Date Format

The API pulls dates directly from our SQL database. As such, all dates are formatted in YYYY-MM-DD hh:mm:ss format with the 4 digit year, dash, 2 digit month, dash, 2 digit day, space, 2 digit hour (0-24), colon, 2 digit minute, colon, and 2 digit second. When sending a date to the API, it is best to send it in this format. The API will attempt to parse dates in other formats, however, using the SQL formatting will ensure greatest accuracy.

Zero Dates

The API avoids the use of NULL values. Instead of using NULL to represent a missing or unknown date, a zero date is used instead. The date will appear as follows:

0000-00-00 00:00:00

Timezone

The API uses only the UTC timezone for returning and setting dates. When displaying or utilizing dates from the API, they will need to be converted into the desired timezone. The timezone can be determined by looking at the account_timezone property on the account object. This is returned when calling account.php or getMe.php.

🚧

When sending dates to the API, make sure to convert the date to the UTC timezone first. Otherwise, you may experience unexpected behavior.