Thursday, 19 April 2012

UtcDateTime function

The compiler gave me an error saying "Operand types are not compatible with the operator"

After reading some information regarding the new UTC date Time for AX 2009 I came to learn that there is a new utility named DateTimeUtil which provides a bunch of date operations such as adding days to a date, converting UTC date times to date, and so on.

You can read more about this utility here http://msdn.microsoft.com/en-us/library/cc619601.aspx

The final code looks like this:


static void SetQuotationDate(Args _args)
{
    SalesQuotationTable sqt;
    ;
    while select forupdate sqt
    {

            try
            {
                ttsbegin;
                    sqt.QuotationDate = DateTimeUtil::date(sqt.createdDateTime);
                    sqt.update();
                ttscommit;
            }
            catch(Exception::Error)
            {
                ttsabort;
                info("Quotation Date is empty");
            }


       
    }
}

No comments:

Post a Comment