Current DateTime with UTC in Navision 2016

  SYNC_DT_INSERT := CURRENTDATETIME;

  UTCOffset := GetUTCOffset();
  EVALUATE(UTCOffsetNumb, UTCOffset);

  SYNC_DT_INSERT := SYNC_DT_INSERT + (UTCOffsetNumb * 36000);

 

LOCAL GetUTCOffset() Result : Text

EVALUATE(lLocalTime, FORMAT(TIME));

lDateTimeTxt := FORMAT(CREATEDATETIME(TODAY,lLocalTime),0,9);

lTimeTxt := COPYSTR(lDateTimeTxt,STRPOS(lDateTimeTxt,'T') + 1);

lTimeTxt := COPYSTR(lTimeTxt,1,STRLEN(lTimeTxt) - 1);

EVALUATE(lUTCTime,lTimeTxt);

lTimeDiffTxt := FORMAT((lLocalTime - lUTCTime) / 3600);

lSign := '';

IF lTimeDiffTxt[1] = '-' THEN BEGIN

lSign := '-';

lTimeDiffTxt := DELCHR(lTimeDiffTxt,'=','-');

END;

EVALUATE(lLocalTime,lTimeDiffTxt);

EXIT(FORMAT(lLocalTime,0,lSign + '<hours24,2><minutes,2>'));

Torna su
Categoria

Navision (974)


Autore

Marco Cecchetti


Data pubblicazione.

17/12/2020



Recensioni

Articolo non ancora recensito