What system default date format to use?

Maxim Veksler picture Maxim Veksler · Jan 27, 2011 · Viewed 15.1k times · Source

I'm setting the standards for our application.

I've been wondering, what default date format should I choose to use ?

It should be:

  • Internationalization & timezone aware, the format should be able to represent user local time
  • Can be efficiently parsed by SimpleDataFormat (or alike, jdk classes only)
  • Programming Language agnostic (can parse in java, python, god forbid C++ :) and co.)
  • Preferably ISO based or other accepted standard
  • Easy to communicate over HTTP (Should such need arises, JSON or YAML or something in this nature)
  • Can represent time down to seconds resolution (the more precise the better, micro seconds if possible).
  • Human readable is a plus but not required
  • Compact is a plus but not required

Thank you,
Maxim.

Answer

jny picture jny · Jan 27, 2011

yyyy-MM-ddThh:mmZ (See ISO 8601) You can add seconds, etc

You can read it easily, it will not be a problem for SimpleDateFormat.