datetime2Str Function

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

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.

Return Value

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


Cc637978.collapse_all(en-us,AX.60).gifNull 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.

Cc637978.collapse_all(en-us,AX.60).gifRight- 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 );

See also

str2Datetime Function

date2Str Function

time2Str Function

Time Zone Overview and Terminology

DateTimeUtil::toStr Method

Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).