NAV 2013 R2 (UK time zone)
StartDateTime holds the DateTime value of 23/04/2014 13:47:30
But…
DT2Time(StartDateTime);
shows 12:47:30
How do I prevent this from happening?
Thanks
Dave K.
NAV 2013 R2 (UK time zone)
StartDateTime holds the DateTime value of 23/04/2014 13:47:30
But…
DT2Time(StartDateTime);
shows 12:47:30
How do I prevent this from happening?
Thanks
Dave K.
Both NAV server and client are on the same time zone?
I don’t know if this problem is related to the fact that in SQL tables values are stored in UTC DateTime: in case can you try with this statement? (sorry but I actually don’t have a UK test environment):
DT2TIME(UTCFunction.DT2UTC(StartDateTime));
PROCEDURE DT2UTC@1000000006(DT@1000000000 : DateTime) UTC : DateTime;
BEGIN
IF DT <> 0DT THEN
EXIT(Convert(DT,TRUE));
END;
LOCAL PROCEDURE Convert@1000000001(DT@1000000000 : DateTime;UTC@1000000001 : Boolean) Result : DateTime;
VAR
WSH@1000000003 : Automation “{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:‘Windows Script Host Object Model’.WshShell”;
MM@1101327001 : Integer;
InitReg@1101327000 : Boolean;
V@1000000002 : Variant;
BEGIN
IF (NOT InitReg) OR (NOT GUIALLOWED) THEN BEGIN
IF ISSERVICETIER THEN
CREATE(WSH,TRUE)
ELSE
CREATE(WSH);
V := WSH.RegRead(‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias’);
MM := 0;
IF EVALUATE(MM,FORMAT(V)) THEN BEGIN
MM := -MM * 60000;
InitReg := TRUE;
END;
END;
IF UTC THEN BEGIN
IF DT2TIME(DT) - MM > DT2TIME(DT) THEN
EXIT(CREATEDATETIME(DT2DATE(DT) - 1,DT2TIME(DT) - MM))
ELSE
EXIT(CREATEDATETIME(DT2DATE(DT),DT2TIME(DT) - MM));
END ELSE BEGIN
IF DT2TIME(DT) + MM < DT2TIME(DT) THEN
EXIT(CREATEDATETIME(DT2DATE(DT) + 1,DT2TIME(DT) + MM))
ELSE
EXIT(CREATEDATETIME(DT2DATE(DT),DT2TIME(DT) + MM));
END;
END;
Also you can try checking and changing on NST the time zone to Coordinated Universal Time and configuring the instance to use Server Time Zone?