any2Date Function [AX 2012]

Updated: August 25, 2010

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

Converts an anytype value to a date value.


date any2Date(anytype object)

Parameter

Description

object

The value to convert to a date.

A date value.

The object parameter can be of most data types, but useful output is obtained when it is of the str or int type. Inappropriate content generates a run-time error.

static void any2DateExample(Args _args)
{
    date myDate;
    str s;   
    int i;
    ;

    s = "2010 6 17"; // A string object, of yyyy mm dd.
    myDate = any2Date(s);
    Global::info(strFmt("%1  is output, from input of \"2010 6 17\"", myDate));

    i = 40361; // An int object, which represents the number of days from 1900/01/01.
    myDate = any2Date(i);
    Global::info(strFmt("%1  is output, from input of 40361", myDate));
}

/**** Infolog display.
Message (04:44:15 pm)
6/17/2010 is output, from input of "2010 6 17"
7/4/2010 is output, from input of 40361
****/

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

Community Additions

ADD
Show: