Hi,
I need to subtract 2 hours from the current date and time, and then convert to ISO8601. I am able to get the new DateTime, but cannot find anything on the conversion? Would there be a simpler way to do this?
NewDate := CreateDateTime(TODAY,TIME);
NewDate - (2 * 60 * 60 * 1000)
T.I.A.
0
Answers
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
NewDateTxt := FORMAT(CURRENTDATETIME, 0, 9);
NewDateTxt := DELSTR(NewDateTxt,STRPOS(NewDateTxt,'.'), 4);
NewDateTxt := replaceString(FORMAT(NewDateTxt), ':', '%3A');
Result = 2018-07-02T12%3A40%3A05Z
Not sure if this is the best way but works for me. Thank you very much for your help
Alternatively you can use the ROUNDDATETIME function to round the CURRENTDATETIME output to full sencods
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Date1 := CREATEDATETIME(TODAY,TIME - (3600000*2));
TimeStamp := FORMAT(Date1,0,'<Year4>-<Month,2>-<Day,2>T<Hours24>%3A<Minutes,2>%3A<Seconds,2>Z');
Result : 2018-07-05T10%3A32%3A32%3A45Z
Thank you for helping a newbie out. Much appreciated.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03