openPMD / openPMD-standard

:notebook: Open Standard for Particle-Mesh Data
http://www.openPMD.org
Creative Commons Attribution 4.0 International
79 stars 29 forks source link

Use ISO 8601 standard for date #220

Open ChristopherMayes opened 4 years ago

ChristopherMayes commented 4 years ago

The base standard has:

But there is a good standard for this: https://en.wikipedia.org/wiki/ISO_8601

I suggest that ISO 8601 is the standard for the date string, e.g. 2020-05-13T19:41:34-07:00

ax3l commented 4 years ago

Good catch, I was thinking the same thing last week when someone posted about ISO 8601.

ax3l commented 4 years ago

Out of the extended formats in ISO 8601, should we go for

   Complete date plus hours, minutes and seconds:
      YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)

or

   Complete date plus hours, minutes, seconds and a decimal fraction of a
second
      YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)

Looks like the decimal fraction of a second can be arbitrarily long, which is good.

ChristopherMayes commented 4 years ago

I usually use datetime builtin Python package to deal with these strings:

datetime.fromisoformat('1997-07-16T19:20:30+01:00')

But @ax3l your second string is not valid.