how to convert string to time in dynamics ax x++

str2time
The str2time function converts a string representation of time to the timeofday value as long as the string is a valid time. If it's not a valid time, the method returns -1.

static void Datatypes_str2time(Args _arg)
{
str timeStr;
timeofday time;
;
timeStr = "09:45";
time = str2Time(timeStr);
info(strfmt("%1 seconds has passed since midnight when the clock
is %2", time, timeStr));
}
The example will print the following to the info:
35100 seconds has passed since midnight when the clock is 09:45

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.