Skip to content

Instantly share code, notes, and snippets.

@markmc
Created April 25, 2014 16:21
Show Gist options
  • Save markmc/11295100 to your computer and use it in GitHub Desktop.
Save markmc/11295100 to your computer and use it in GitHub Desktop.
Nova API timestamp formats
$> git grep '20[0-9][0-9]-' doc/api_samples/ | wc -l
509
with UTC TZ:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z' doc/api_samples/ | wc -l
230
with zero offset TZ:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-\+]00:00' doc/api_samples/ | wc -l
157
(note, apparently -00:00 is not allowed by iso8601 but is allowed by rfc3339, see
"Unknown Local Offset Convention" in the RFC)
with non-zero offset TZ
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-\+]0[1-9]:00' doc/api_samples/ | wc -l
6
with no TZ and decimal seconds:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*' doc/api_samples/ | wc -l
58
with no TZ and non-decimal seconds:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][^.Z+-]' doc/api_samples/ | wc -l
5
with no TZ, non decimal seconds and no T separator:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9][^.Z+-]' doc/api_samples/ | wc -l
10
with no TZ, decimal seconds and no T separator:
$> git grep '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*' doc/api_samples/ | wc -l
47
confirm that's them all:
$> git grep '20[0-9][0-9]-' doc/api_samples/ | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-\+]00:00' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-\+\]0[1-9]:00' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9][^.Z+-]' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9][^.Z+-]' | grep -v '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*' | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment