Replace time in D365Fo using X++
public utcdatetime checkTime(utcdatetime _dateTime)
{
FromTime second = DateTimeUtil::second(_dateTime);
FromTime minute = DateTimeUtil::minute(_dateTime);
utcdatetime dateTime = DateTimeUtil::addMinutes(DateTimeUtil::addSeconds(_dateTime,-second),-minute);;
;
if((minute >= 15 && minute < 30) || (minute >= 30 && minute < 45))
{
dateTime = DateTimeUtil::addMinutes(dateTime, 30);
}
else if(minute >= 45 && minute < 60)
{
dateTime = DateTimeUtil::addHours(dateTime, 1);
}
return dateTime;
}
No comments:
Post a Comment