HTTP API Design
github.com
github.com
Use UTC times formatted in ISO8601
Accept and return times in UTC only. Render times in ISO8601 format, e.g.:
"finished_at": "2012-01-01T12:00:00Z"
So what if the time zone is important? E.g. the time a user purchased a product. The UTC time is obviously consistent throughout the system but presented without a time zone might not make an awful lot of sense to a user, especially if the time zone is something plus or minus 10 hours.Wouldn't an RFC 2822 formatted date make not more sense; "Thu, 21 Dec 2000 16:01:07 +0200". You still have your UTC but you are now capable to represent the time to a user within a context that makes sense.
In your example, you'd just present the time in the user's timezone, via a rendering transformation.
The API shouldn't concern itself with formatting details, but absolutely the end user should never see an iso8601 timestamp!
Besides the unnecessary code complication and extra compute cycles on the server side, why destroy your opportunities for caching the data?