Hi,
I am trying to create a report in ax 2009 which I have to get the month and year of the date entered by the user in the form. lets say user enters 26/10/2012, I need October, 2012 as a result in the Report.
Please help.
Hi,
I am trying to create a report in ax 2009 which I have to get the month and year of the date entered by the user in the form. lets say user enters 26/10/2012, I need October, 2012 as a result in the Report.
Please help.
Hi,
you can use the dateTimeUtil class to get the month and the year but it takes utcDateTime values as parm,
you must first convert your datetime parm in utcDateTime format and then use the year() and month() methods of the dateTimeUtil class.
to convert date to DateTime, you can use the following code :
DateTimeUtil::newDateTime(yourDate, 0, DateTimeUtil::getCompanyTimeZone());
Hope it helps
Regards,
Thomas
Hey Thomas,
I am sorry I am new to Ax, so I am not able to understand whether it is a solution for my problem or not. Let me first clear my query
What i need is, I have a form in which user enters a date say 25-10-2012, now based on this input I have to create a report which takes october, 2012 as a result.
For this I have to create a method which should return October, 2012. Probably I have to create a Display method for this.
Need Help.
Thanks.
Hi pankaj,
use the mthOfYr to get month of the date ,Yr to get year of that date
mthName(mthOfYr (25-10-2012)); – > u ll get October
Yr(25-10-2012); – > u ll get 2012
static void Job49(Args _args)
{
TransDate transDate = str2date(“02/11/2012”,123);
;
info(strFmt("%1,%2", mthName(mthOfyr(transDate)),year(transDate)));
}
Thanx Wei, that solved my purpose.