If we got a data from the external application like "2020-10-07T11:55:27". We can use the below code to convert it to UTCdatetime.
The above format is occurred when user send a datetime field from .NET through OData (Edm.Datetime).
class ConvertStr2UTCdatetime_Job_Test
{
public static void main(Args _args)
{
str testStr = "2020-10-07T11:55:27";
utcdatetime testUTCdateTime;
;
testStr = strReplace(testStr, "T", " ");
testUTCdateTime = str2datetime(testStr, 321);
info(strFmt("testUTCdateTime %1", testUTCdateTime));
info('done');
}
}
Until the next post!
Hi Rum, DateTimeUtil::parse(str _testStr) should also work (in all versions which have this function).
ReplyDeleteHi, thank you very much for your suggestion! That is very helpful!
DeleteMany thankx man :)
ReplyDelete