Date to UTCDateTime Convertion Dynamics Ax 2012
Usually we have to convert date to UTCDateTime. That is usally case when we have to query on createdatetime filed of very table, which filled when new row is created.
We for this purpose we have to create use DateTimeUtil::newDateTime function. This function takes two values one for date, and second for time. So time values will be range beween 0 and 86400. It means when value time is 00:00:00 value will be 0 and when time is 23:59:59 then value will be 86400. Consider following code which creates start and end date for same date.
Date _Currentdate;
utcDateTime _UtcStartPeriod;
utcDateTime _UtcEndPeriod;
;
_currentdate=today();
_UtcCurrentPeriod = DateTimeUtil::newDateTime(_currentdate,0);
_UtcEndPeriod = DateTimeUtil::newDateTime(_UtcEndPeriod,86400);

Like
Report
*This post is locked for comments