Stream: implementers
Topic: How to clear time zone in HAPI FHIR DateTimeDt
Brian Reinhold (Oct 27 2016 at 12:44):
I create a DateTimeDt object (and likely this is true with the STU3 analog) but I do not want a timezone. Does anyone know how to clear the time zone? I tried putting a "null" in the setTimeZone() arguement but that caused the remainder of the resource not to get generated. If I specify nothing I get the defaultTimeZone.
James Agnew (Oct 27 2016 at 13:42):
Unfortunately this is not legal in FHIR, which is why HAPI is blocking you from doing it. All dateTime values that include a time component must also include a timezone offset.
This is troublesome in device-land as my colleagues here keep reminding me, but it ultimately prevents a very common source of errors..
Brian Reinhold (Oct 27 2016 at 13:47):
Yes, I now recall that which is a little bit of a disappointment. In V2 messaging not including the time zone indicates that the device does not have a time zone at all. Many devices don't. But we will just have to accept that we cannot indicate that the device lacks any time zone knowledge. In the end that means that the time zone is assumed to be the current time zone, even if it is stored data. We simply don't know. Now it looks like the agent does know. Not a really big issue though.
Grahame Grieve (Oct 27 2016 at 19:05):
I'm not sure that I follow this. Is it not known what timezone the device is in?
James Agnew (Oct 28 2016 at 20:03):
I think in some cases it's not. Brian, jump in here if I'm getting this wrong but I believe a bunch of devices store times in this wacky format of "epoch time that I received during bluetooth pairing + offset in millis since that time"
James Agnew (Oct 28 2016 at 20:05):
In our mappings we just use GMT when we map that to FHIR, so no big deal.
Last updated: Apr 12 2022 at 19:14 UTC