Use standard formats for date times

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the data category.

Last Updated: 2024-11-21

When in doubt, always store and transfer dates in ISO 8601, the most popular standard.

Some reasons why?

1. SQL DBs use it:

2. ISO 8601 gets output by JavaScript's Date toJSON method

YYYY-MM-DDTHH:MI:SS.MSSZ - e.g 2012-04-23T18:25:43.511Z

3. Many backend frameworks (e.g. Laravel) work out of the box with it.

e.g. you get date time validations working without any messing around

Resources