preloader-matrix

Alfasith

DateTime Handlings in AX 2012 / D365

static void AlfTimeAdd(Args _args)
{
TransDateTime    d = DateTimeUtil::getSystemDateTime();
TransDate       d3 = today();
TransDateTime    d1,d2;
;
print d;
print d3;
d1 = DateTimeUtil::addHours(d,4); // To add 4 hours from current time

print d1;
d2 = Datetimeutil::newDateTime(d3,7.5*60*60); // I need today 7.30 Am
print d2;

print DateTimeUtil::addHours(d,4);
print DateTimeUtil::addDays(d,4);
print DateTimeUtil::addMinutes(d,4);
print DateTimeUtil::addMonths(d,4);
print DateTimeUtil::addYears(d,4);

pause;
}

static void AlfaTime(Args _args)
{
str t = “25 12 2019 10:06:00 AM”;
str t1 = “25/12/2019 10:06:00 AM”;
str t2 = “25-12-2019 10:06:00 AM”;
str t3 = “25-Dec-2019 10:06:00 AM”;
;
print str2datetime(t,123);
print str2datetime(t1,123);
print str2datetime(t2,123);
print str2datetime(t3,123);
print  str2datetime(“2 25 1985 11:04:59 pm” ,213 );
pause;

}

Leave a Reply

Your email address will not be published.