Issues Date/Time With Serverless functions

Published on
Issues Date/Time With Serverless functions

Photo by Boxed Water Is Better

Issues Dealing With Date/Time

Today my team got a complaint from a customer about

Timestamp is different between PROD and STG

There are quite a few issues with dates time and distributed system in general(distributed clients as well as distributed decision services)

  1. Identical Serverless functions could be running in different data center with different TZ
  2. Two client UIs could be running in different TZ.
  3. Mobile users, using the same application may travel to a different place. They expect the application to continue working correctly.


Convert all date/time to UTC before writing to the JSON payload:

For example:

  1. 2022-05-20T00:00:00.000Z This represents the date/time as ISO 8601 directly to the UTC reference (that is with no time zone specified).

  2. 1653004800000 The same date/time as the number of ms since epoch


IOS 8061