Beijer Electronics (formerly QSI Corporation)
http://www.qsiforums.com/

Timezone
http://www.qsiforums.com/viewtopic.php?f=6&t=3877
Page 1 of 1

Author:  Fonzy [ Wed Sep 02, 2009 11:38 am ]
Post subject:  Timezone

Hi,

In order to use the Data functions to convert time to hours, minutes, etc. do I have to set the Timezone someplace? All our time is GMT and I want to make sure I'm converting it correctly. Something tells me this is a dumb question.

Thanks,

Joe

Author:  Jeremy [ Wed Sep 02, 2009 11:39 am ]
Post subject:  Re: Timezone

Which data functions are you referring to?

Author:  Fonzy [ Wed Sep 02, 2009 11:49 am ]
Post subject:  Re: Timezone

I meant Date functions. Specifically,
DateTimeFunctions.ConvertToRTCTime

Author:  Jeremy [ Wed Sep 02, 2009 11:52 am ]
Post subject:  Re: Timezone

The DateTimeFunctions are timezone agnostic (they have no concept of a time zone).

You will need to manually offset GMT to local time before calling that function.

Another thing to keep in mind if you are getting your dates from an external source is that they do not use a time_t (seconds from 1970), rather they measure in seconds from Jan 1, 2000. So you may need to apply another offset to convert from a time_t to a timehandle.

Author:  Fonzy [ Wed Sep 02, 2009 12:54 pm ]
Post subject:  Re: Timezone

Jeremy,

I have offset the time to Jan 1, 2000. But what do you mean

"You will need to manually offset GMT to local time before calling that function."?

I get a time from an external source that is in GMT time. I offset the time to Jan 1, 2000 then use the functions. That should be all I have to do correct? Or am I missing something?

Author:  Jeremy [ Wed Sep 02, 2009 12:57 pm ]
Post subject:  Re: Timezone

Probably the easiest thing to try is just see what you get. If you are off by a few hours then you know you need to offset for local time.

I suppose "I offset the time to Jan 1, 2000" is perhaps a bit ambiguous (as, in fairness, was my earlier comment). Are you offsetting your GMT time_t time to 12:00:00 am, Jan 1, 2000 local time or GMT time? If you are offsetting to local time then you are done. If you are offsetting to GMT time then you will probably still have to offset to local time.

At this point, I would take a known time and see what I get out and decide how to proceed from there.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/