Handling Timezones - UTC

Hi,

Normally when I get a date-time stamp, it comes with, either a GMT specification, like

2015-05-07T14:22:14.760Z

where the Z indicates GMT, or an offset added onto the end like

2015-05-07T14:22:14.760Z+10.0

Question:

  1. Are UTC times supported, or is it a time without zones?
  2. If I want to store a GMT time, and retrieve it do i need to subtract my local offset in order to get back the original input data?

for example , my current offset is +10 and my results are as below

-------------- object => threat-actor ------------------------------
 In=> created: 2016-08-08T15:50:10.983Z, modified 2016-08-08T15:50:10.983Z
Out=> created: 2016-08-09T01:50:10.983000Z, modified 2016-08-09T01:50:10.983000Z

it looks pretty obvious, but just confirming

Also what happens if the database is in London, but the query is made from Sydney? How do i ensure the GMT time is always returned properly?

A datetime attribute is stored as date and time with no awareness of timezones. i.e: it consists of year-month-day-hour-minute-second-nanosecond.

TypeDB doesn’t currently have a datetimeoffset data type. Best practice would be to always store UTC datetimes.

1 Like