datetime2Str Function

Dynamics AX 2009

Converts a utcdatetime value into a string.

str datetime2Str(
    utcdatetime datetime
    [, int flags = DateFlags::None])




The utcdatetime value to convert.


A DateFlags enumeration value that indicates whether to use local settings for right-to-left output.

A string that represents the utcdatetime value that was input as the datetime parameter.

Null Date-Time Input

If the minimum utcdatetime value is input for the datetime parameter, the datetime2Str function treats it as a null input value. This causes the function to return an empty string.

The date-time of 1900-01-01T00:00:00 is returned by the DateTimeUtil::minValue method. This minimum value is treated as null.

Right- to-Left Local Settings

The default behavior of this function is to output the string in left-to-right sequence, with the year portion leftmost. However, the flags parameter value of the DateFlags::FormatAll enumeration value directs the function to output in right-to-left sequence if the local settings are configured for right-to-left.

The format of the toStr method of the DateTimeUtil class is unaffected by regional settings.

static void jobTestDatetime2str( Args _args )
    utcdatetime utc2 = 1959-06-17T15:44:33;
    str s3;
    s3 = datetime2Str( utc2 );
    info( s3 );

Community Additions