Recommended Date Format for REST API

I am writing an application that provides a REST API. Some query parameters will be date / time (accurate to the second), and some of the responses will be timestamps (accurate to the millisecond).

The implementation of the API on the server is in Java. Client applications can be any - java, javascript, .NET. The API returns XML or JSON data. Date / time data is stored in an Oracle database.

Does anyone have any recommendations based on preliminary pain about which format of the best format is designed to convey these date / time values. I think I'm just using the good old image to store milliseconds from January 1, 1970, 00:00:00 GMT.

Change The date range covered by the API is for real-time events, so there will be nothing until 2010 and (tune in to abuse here) after 2038.

I think the best will be determined

a) A wide variety of languages ​​support the conversion of this long to an internal date object, without the need to write code to do this.

b) Lowest processor overhead (on server application)

+7
java javascript datetime timestamp date-formatting
source share
1 answer

ISO 8601 fully

Using any epoch-based method means that you are tied to the range (on most systems) of a signed 32-bit INT (1901-12-13T20: 45: 52 + 00: 00 - 2038-01-19T03: 14: 07 + 00: 00), which, in fact, is more a timestamp than a date, since it cannot handle far-reaching historical or future dates.

+8
source share

All Articles