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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With