I use the code below to determine the number of seconds offset from GMT for the 
current time zone. This could be added back to a GMT time stamp to get the 
local time.

John DeSoi, Ph.D.


C_LONGINT($0)

C_DATE($zDate;$gmtDate)
C_TIME($zTime;$gmtTime)
C_TEXT($str)

$zDate:=Current date

$str:=String($zDate;ISO date GMT;$zTime)  //2010-09-13T16:11:53Z
$str:=Substring($str;1;Length($str)-1)  //Remove the Z or it gives us back 
local time.
$gmtDate:=Date($str)
$gmtTime:=Time($str)

Case of 
  : ($zDate=$gmtDate)
    $0:=$zTime-$gmtTime
  : ($zDate>$gmtDate)
    $0:=(?24:00:00?-$gmtTime)+$zTime
  : ($gmtDate>$zDate)
    $0:=0-((?24:00:00?-$zTime)+$gmtTime)
End case 


> On Dec 20, 2018, at 11:54 AM, Nate Rheaume via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> We have clients that are accessing the same server database from different 
> time zones. We would like to store date/time using GMT and then display it in 
> the users local time zone.
> 
> Using the String command it's easy to convert to GMT but I'm not sure what 
> the best way is the convert GMT back to the local time zone.
> 
> Has anyone else dealt with this issue? Any feedback is appreciated.

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to