Skip to content

Date Serialization

Dates can be serialized in 2 ways.

  • Epoch e.g. /Date(1640991600000-0000)/)
  • Iso8601 e.g 1965-03-25T11:05:01.0000000

When requesting an API key from Momentum, please let us know in what format that you would like to have your dates formatted.

Unix/Epoch Time

  • Compact
  • Easy to do arithmetic actions without any libraries, i.e. var tomorrow=now()+606024
  • Not human-readable
  • Cannot represent dates before 1 January 1970
  • Cannot represent dates after 19 January 2038 (if using Int32)
  • Timezone and offset are "external" info, there is ambiguity if the value is UTC or any other offset.
  • Officially the spec supports only seconds.
  • When someone changes the value to milliseconds for better resolution, there is an ambiguity if the value is seconds or milliseconds.
  • Older than ISO 8601 format
  • Represents seconds since 1970 (as opposed to instant in time)
  • Precision of seconds

Iso8601 Time

  • Human readable
  • Represents instant in time, as opposed to seconds since 1970
  • Newer then Unix time format
  • Specifies representation of date, time, date-time, duration and interval!
  • Supports an offset representation
  • Precision of nanoseconds
  • Less compact