Author | Topic: Re: Timezone | |
---|---|---|
Geoffrey Cohen | Re: Timezone on Sun, 04 Jun 2006 12:13:11 +1000 "Frans Breukelman" <frans@dacom.nl> wrote: >Is there a (fullproof) way to get the Client's timezone? >I want to use date() and time() in a WAA application >and show the Client's time, not the time of the server. Maybe a bit late, but I just wrote this Function to grab the Time Zone, without using any API calls FUNC GetTimeZone() Return Timezone in Hours, relative to GMT == 0 Uses the Offset allowed in Time() to set the Time Zone Loop thru all allowed values until we get the correct Time Zone LOCAL TimeZoneCntr LOCAL TimeInSecs := SECONDS(TIME()) LOCAL MantissaSeconds := TimeInSecs - INT(TimeInSecs) Allow enuf time to grab a few Time()'s DO WHILE MantissaSeconds > 0.8 DELAY(1) TimeInSecs := SECONDS(TIME()) MantissaSeconds := TimeInSecs - INT(TimeInSecs) ENDDO FOR TimeZoneCntr = 0 TO 23 STEP 0.5 Allow for 1/2 hour offsets IF TIME() == TIME( ALLTRIM(STR(60*TimeZoneCntr)) ) EXIT ENDIF NEXT RETURN TimeZoneCntr |