Display the Date by calculating the user value added to the day,month,year for an Existing Date in Ax 2012

date1

utcDateTime t;
t=DateTimeUtil::newDateTime(today(), 0, DateTimeUtil::getCompanyTimeZone());

if(InventTable_Warperiod_JKG.valueStr()==”Days”)
info(strFmt(“Your Warrenty Period is Upto : %1″,DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::addDays(t,InventTable_Warlength_JKG.value()),DateTimeUtil::getUserPreferredTimeZone()))));
if(InventTable_Warperiod_JKG.valueStr()==”Months”)
info(strFmt(“Your Warrenty Period is Upto : %1″,DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::addMonths(t,InventTable_Warlength_JKG.value()),DateTimeUtil::getUserPreferredTimeZone()))));
if(InventTable_Warperiod_JKG.valueStr()==”Years”)
info(strFmt(“Your Warrenty Period is Upto : %1”,DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::addYears(t,InventTable_Warlength_JKG.value()),DateTimeUtil::getUserPreferredTimeZone()))));

** If you want to do it in Reverse then code like this

**Just give the negative numeric value

Advertisements

One comment on “Display the Date by calculating the user value added to the day,month,year for an Existing Date in Ax 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s