Ahmed Al Hafoudh
Ahmed Al Hafoudh

Reputation: 8429

What datetime format would you use in your JSON API?

Whould it be UNIX timestamp format or some ISO?

UPDATED
Considering that API consumer are more programming languages. (Java, C++, JavaScript)

UPDATED2
And what about this problem? http://beyondrelational.com/blogs/nakul/archive/2011/02/10/unix-timestamp-and-the-year-2038-problem.aspx And what about dates before 1970?

Upvotes: 0

Views: 334

Answers (2)

Silvertiger
Silvertiger

Reputation: 1680

it depends on the destination language and your comfort with it. for example, in php I just use the epoch (UNIX time stamp) since you can easily get a date from

$epoch = time();
date("l F jS, Y",$epoch);
// "Wednesday January 18th, 2012" if variable was now();

and i find it easier to do comparisons and modifications with it as well using time(), mktime() etc...

Upvotes: 0

cdeszaq
cdeszaq

Reputation: 31280

Some ISO standard. It's a standard for a reason.

Upvotes: 2

Related Questions