Handling time zones in storage?

26 views
Skip to first unread message

Andre Luis - Shift

unread,
Apr 23, 2013, 7:59:13 AM4/23/13
to intersys...@googlegroups.com

Hi,

We are developing an application and a doubt about how to store time zone came up. May you share your experience with us and help us to deal with it.

Our customer has a server located in São Paulo and its time zone is tree time hours behind Greenwich. They have office in Sao Paulo (headquarter) and Cuiaba (four hours behind Greenwich). The information stored in our software is about medical records. So, it keeps information about the date and time that the patient arrived at the hospital/clinical laboratory and beside it store logs to generate the turnaround time.

If I have to store the time, what time zone should I use?

Store everything using São Paulo time zone and math every time we render the time?

Store the time of the place where the patient is attended?

Robert C.Cemper SSE

unread,
Apr 23, 2013, 10:38:36 AM4/23/13
to intersys...@googlegroups.com, Andre Luis - Shift
Hi,
Based on practical experience I suggest to write any timestamp just in UTC
and leave to conversion to local time to the client application.
Similar before writing dates convert it to UTC at client side.
The client always knows his actual TimeZoneOffset especially across
change from DTS to Std time and back. In addition your application
is everywhere the same, world wide.

Regards,
Robert

Am 23.04.2013 13:59, schrieb Andre Luis - Shift:
>
> Hi,
>
> We are developing an application and a doubt about how to store time
> zone came up. May you share your experience with us and help us to
> deal with it.
>
> Our customer has a server located in S�o Paulo and its time zone is
> tree time hours behind Greenwich. They have office in Sao Paulo
> (headquarter) and Cuiaba (four hours behind Greenwich). The
> information stored in our software is about medical records. So, it
> keeps information about the date and time that the patient arrived at
> the hospital/clinical laboratory and beside it store logs to generate
> the turnaround time.
>
> If I have to store the time, what time zone should I use?
>
> Store everything using S�o Paulo time zone and math every time we
> render the time?
>
> Store the time of the place where the patient is attended?
>
> --
> You received this message because you are subscribed to the Google
> Groups "InterSystems: Zen Community" group.
> To post to this group, send email to InterSys...@googlegroups.com
> To unsubscribe from this group, send email to
> InterSystems-Z...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/InterSystems-ZEN?hl=en
> Zen Community Terms and Conditions:
> http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions
> ---
> You received this message because you are subscribed to the Google
> Groups "InterSystems: Zen Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to intersystems-z...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Andre Luis - Shift

unread,
Apr 24, 2013, 9:06:08 AM4/24/13
to intersys...@googlegroups.com, Andre Luis - Shift
Thanks Robert for sharing your experience.
We had a meeting yesterday and we are going to use this approach to deal with that.


Em terça-feira, 23 de abril de 2013 11h38min36s UTC-3, Robert Cemper escreveu:
Hi,
Based on practical experience I suggest to write any timestamp just in UTC
and leave to conversion to local time to the client application.
Similar before writing dates convert it to UTC at client side.
The client always knows his actual TimeZoneOffset especially across
change from DTS to Std time and back. In addition your application
is everywhere the same, world wide.

Regards,
Robert

Am 23.04.2013 13:59, schrieb Andre Luis - Shift:
>
> Hi,
>
> We are developing an application and a doubt about how to store time
> zone came up. May you share your experience with us and help us to
> deal with it.
>
> Our customer has a server located in S�o Paulo and its time zone is
> tree time hours behind Greenwich. They have office in Sao Paulo
> (headquarter) and Cuiaba (four hours behind Greenwich). The
> information stored in our software is about medical records. So, it
> keeps information about the date and time that the patient arrived at
> the hospital/clinical laboratory and beside it store logs to generate
> the turnaround time.
>
> If I have to store the time, what time zone should I use?
>
> Store everything using S�o Paulo time zone and math every time we

John Bertoglio

unread,
Apr 24, 2013, 3:20:45 PM4/24/13
to intersys...@googlegroups.com, Andre Luis - Shift
This is how we store dates as well. GMT is the only sensible approach even for a business that (currently) only spans one time zone. We also convert them to numeric seconds ($zts...=p1*86400 +p2). This makes calculating offsets very easy. Add 3 hours: just add 60*60*3 and convert back to $zts to get a display date. If you need to do one of those screwy half hour timezones, you can us 7.5 as the multiplier. Need to know the orders in the last 5 min? Just select where current nTime (numeric) -recordNTime less than 300. And so on. $h was a clever construct but we think this is a better way to store and process date math on modern hardware. 
Reply all
Reply to author
Forward
0 new messages