NextGen APIs

Dates and time zone

Time zone

The accepted time zone format is the standard time zone identifier, as described in the IANA https://www.iana.org/time-zones and as listed in the https://timezonedb.com/time-zones page under the Time Zone column of the table.

Examples: Europe/Rome, America/New_York, …

See https://overit-spa.atlassian.net/wiki/x/nQFB7hc for more details about Local and Central date types.

Date and time formats

To correctly handle both single time zone and multi time zone libraries, the time zone of the application server must be equal to the time zone of the database. The suggested time zone for the AS and DB is UTC for multi time zone projects. The suggested time zone for the AS is the time zone of the country (or the reference time zone) for single time zone projects, for the DB is still UTC.

Date types that the application handles are the following:

  • Central: dates that represent temporal instants, they are created and saved with the application server time zone

  • Local: dates that are projected on a specific time zone, they are the most used in the application and are visible and modifiable by users

Note that when receiving an input both a date and a time (date/time), the format can be any of the ones described in the ISO 8601 document, except for date/time formats without the time zone specification. If a date/time is received without the time zone specification, the system will return an error 400 Bad Request.

Implementation details
Java specification

To handle the different possible time zones that might be part of an API, the ZonedDateTime Java object must be used to represent the date/time in the DTO; moreover, the annotation @DateType(…) can be used to specify if the date is either LOCAL or CENTRAL. LOCAL means that date and time are expressed in a specific local time. CENTRAL means that date and time are expressed in the application server time zone.