String format options for utcDateTime

I’ve run into a problem that reminded me that while X++ types and corresponding CLR types (such as str and System.String) can often be user interchangeably, they aren’t the same. I was trying to convert a utcdatetime value to the standard “sortable” format in D365FO, for which I wrote the following code: utcdatetime currentDateTime = …

Continue reading ‘String format options for utcDateTime’ »

Custom date and time format

I was extending a customization of Dynamics AX when I ran into the following piece of code. It formats the current date and time to something like 20150525_0042. str dateValue, dateFormat;   dateValue = date2str( systemDateGet(), 321, DateDay::Digits2, DateSeparator::None, DateMonth::Digits2, DateSeparator::None, DateYear::Digits4, DateFlags::FormatAll);   dateFormat = strFmt( "%1%2%3", dateValue, ‘_’, subStr( strRem(time2Str(timeNow(), TimeSeparator::Space, TimeFormat::Auto), ‘ …

Continue reading ‘Custom date and time format’ »