AX / D365FO – Extract Time Info (in seconds) from DateTime Field

You can use DateTimeUtil::time(MyDate);

Retrieves the number of seconds that have elapsed since midnight as a timeOfDay value from the specified utcdatetime value.

TimeOfDay   secondsElapsed = DateTimeUtil::time(MyDate);

info(time2str(secondsElapsed, TimeSeparator::Auto, TimeFormat::Auto));
info(time2StrHM(secondsElapsed));
info(time2StrHMLeadingZero(secondsElapsed));
info(time2StrHMS(secondsElapsed))

Leave a comment