All date functions in Ax 2012

HI,

Below are the functions used to get the dates in different scenarios

Dates :

Date d= prevYr(datefrom);

Date : dayOfMth(systemdateget())

month from date : mthOfYr(systemdateget())

Year from date : year(systemdateget())     

Start of  month : DateStartMth(today());

End of month : endmth(today()) 

//Difference of dates in Data, Month, year

               Day     = intvNo(_to, joindate, intvScale::Day);

                month   = intvNo(_to, joindate, intvScale::Month);

                years   = intvNo(_to, joindate, intvScale::Year);

//UTCdatetime to DATE formate

                utcDateTime                     validateDate;

                validateDate = DateTimeUtil::addDays(validateDate, 5);

//To compare date only from utcdatetime until

if ( DateTimeUtil::date(validateDate) ==  DateTimeUtil::date(HcmPositionWorkerAssignment.ValidTo)) 

//converting Date to UTC date time

DateTimeUtil::newDateTime(today(), 0, DateTimeUtil::getCompanyTimeZone()); 

//Converting datetime strning to UTCDate time

 dateTime = str2datetime(“24.12.2011 12:01:59″, 123);

 dateTime = str2datetime( “2011/02/25 23:04:59″ ,321 );

 dateTime = str2datetime( “Feb-2011-25 11:04:59 pm” ,231 );

 dateTime = str2datetime( “2 25 2011 11:04:59 pm” ,123 ); 

The sequence 123 describes the position of day (1), month (2), year (3).

 

Advertisements

2 thoughts on “All date functions 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