Hello I'm quite new at BDL scripting so please be gentle :) I have a problem converting a timestamp that I grab from an xml and convert it into let's say second since midnight My method of grabbing the xml value is: WebXmlParseNodeValue(sXmlParseRs1Rt1Tt1, STRING_COMPLETE, ToEncoding("/Results[1]/Result[1]/TestTime[1]"), 0, NULL, 1, ToEncoding("text/xml; charset=utf-8") ); the above code generates a date and time format like this: 2018-11-14T11:13:52.3282097+01:00 I then pick out the date and time in separate variables StrRegexImmediate( sXmlParseRs1Rt1Tt1,"[0-9]+-[0-9]+-[0-9]+","&", sXmlParseRs1Rt1Tt1b ); StrRegexImmediate( sXmlParseRs1Rt1Tt1,"[0-9]+:[0-9]+","&", sXmlParseRs1Rt1Tt1c ); I can verify that I've grabbed the correct values with RepMessage ("formatted Date sXmlParseRs1Rt1Tt1b: " +sXmlParseRs1Rt1Tt1b, SEVERITY_INFORMATIONAL); //this output = 2018-11-14 RepMessage ("formated ToD sXmlParseRs1Rt1Tt1c: " +sXmlParseRs1Rt1Tt1c, SEVERITY_INFORMATIONAL); //this output =11:13 I have also declared nTime variable nTime := GetCurrentTime(); //this generates current time in seconds since midnight So after this intro, my question is; how do I convert the HH:MM-string of sXmlParseRs1Rt1Tt1c into a number variable that I can use to compare it with the value of nTime? [magic code I need help with that converts sXmlParseRs1Rt1Tt1c into seconds from midnight and sets a new variable of nPleaseMakeItWork ] Then is should just be a matter of if (nTime - nPleaseMakeItWork > 600) then Repmessage ("Too old ",SEVERITY_ERROR); else Repmessage ("We are good ",SEVERITY_INFORMATIONAL); end; Looking forward to your replies
↧