Tuesday, 8 January 2013

Microsoft Dynamics AX 2012 R2 - any2Date Function

Converts an anytype value to a date value.


Function

  • date any2Date (anytype object)

Parameters

  • Parameter: object
  • Description: The value to convert to a date.
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.

Return Value

  • A date value.

Example

  • X++
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
****/

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - any2Date Function' was informative. Please feel free to leave your comments.

No comments:

Post a Comment