RESTful API Design - Best Practices for Changeover Dates

advertisements

What is the best practice for sharing dates in an API?

Is it best to share dates with an SQL-like datetime format - 'YYY-MM-DD HH:MM:SS' with an optional timezone embedded inside of it?

Or is it best to use milliseconds based on UTC?


I prefer to encode times as full ISO 8601 dates, but with the constraint that my code only ever generates them in the UTC timezone. If you've got a good date parsing library (e.g., Jodatime for Java) accepting full ISO 8601 is not particularly difficult and they're at least somewhat readable. (Offsets from some epochal instant are nothing like as easy for people to read.)