web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Get system's current date and time in D365. #ax #d365 #dynamics

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97
Here I'm trying to print the current date and time. I required to get the system's current date and time and use it in a specified format(YYMMDD_HHMMSS).


YearBase year          = DateTimeUtil::year(DateTimeUtil::getSystemDateTime());
int month                 = DateTimeUtil::month(DateTimeUtil::getSystemDateTime());
int dat                      = DateTimeUtil::day(DateTimeUtil::getSystemDateTime());
int hour                    = DateTimeUtil::hour(DateTimeUtil::getSystemDateTime());
Minutes minute       = DateTimeUtil::minute(DateTimeUtil::getSystemDateTime());
Seconds second       = DateTimeUtil::second(DateTimeUtil::getSystemDateTime());
 info(strFmt("%1%2%3_%4%5%6", year, month, dat, hour, minute, second));


Output: 20231122_115315

Comments

*This post is locked for comments