str2Date Function [AX 2012]

Updated: November 17, 2010

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

Converts the specified string to a date value.


date str2Date(str _text, str _sequence)

Parameter

Description

_text

The string to convert to a date value.

_sequence

A three digit integer that describes the positions of the day, month, and year in the string to convert.

A date value.

Use the following values to specify the positions of the day, month, and year in the _sequence parameter:

  • day: 1

  • month: 2

  • year: 3

For example, if the sequence in the string is month, year, then day, the _sequence parameter must be 231.

A zero date is returned if the input parameters specify an invalid date. The following two examples specify an invalid date:

  • str2Date("31/12/44", 123) // Year must be four digits to reach the minimum of January 1 1901.

  • str2Date("31/12/2044", 213) // 213 means the month occurs first in the string, but 31 cannot be a month.

static void str2DateExample(Args _arg)
{
    date d;
    ;
    d = str2Date("22/11/2007", 123);
    print d;
    pause;
} 

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

Community Additions

ADD
Show: