Timezone question

May 30, 2011 at 3:49 AM

Hi Rob.

I saw your response to an earlier post regarding using UTC timezone. I have a couple of related questions (I am in CDT timezone). When I am creating a record, say a Weight record, and want to set the time on that, what timezone should I use? When I use the following lines of code:

Calendar cal = Calendar.getInstance();

weight.setWhen(DateTime.fromCalendar(cal));

 

it seems that the outgoing request doesn't have any "<tz>" element in it; so if my calendar instance is reflecting 1pm (CDT), then the <when> element will have the corresponding 1pm but the timezone will be empty. I presume the lack of tz element will be interpreted by the server as UTC so when my request is received by the server, server will assume that it was 1pm UTC and not CDT. Is this correct? If so, it practically means I need to do the following:

Calendar cal = Calendar.getInstance(TimeZone.getTimeZne("UTC"));

weight.setWhen(DateTime.fromCalendar(cal)); // my 1pm (CDT) will now be entered as 6pm (UTC)

to get the correct data into the server.

 

Assuming that is the case, when I use the last approach and use UTC and import a data to the server, then if I go and look at the data in the web interface to the server (HealthVault web interface), the time there is shown as 6pm (no timezone on the interface). This would be somewhat confusing for a user since, most likely, the user is also in the same timezone as the device that submitted his data (i.e. CDT) and when checking on line, he sees 6pm and not 1pm.

 

Please advise.

Many thanks

Ali.

Coordinator
Jun 1, 2011 at 4:28 AM
Edited Jun 2, 2011 at 5:44 AM

Created and updated dates are UTC. 

Thing data often uses HealthVault DateTime or ApproximateDateTime.  Those dates may not carry timezone information.  You should use dates and times that make sense to the user. 

 

--Rob