Hi,
In this post we will see how to a day from given date time field and for demo purpose used static methods of class DateTimeUtilClass.
Note: CG_DeductDaysFromDateTime is a runnable class.
public static void main(Args _args)
{
utcdatetime dateTime;
date datePart;
TimeOfDay timePart;
int monthPart;
dateTime = DateTimeUtil::getSystemDateTime();
// Deducts one day from current day
datePart = DateTimeUtil::date(dateTime) - 1;
timePart = DateTimeUtil::time(dateTime);
dateTime = DateTimeUtil::newDateTime(datePart, timePart);
info(strFmt("New date time is %1", dateTime));
dateTime = DateTimeUtil::getSystemDateTime();
dateTime = DateTimeUtil::addDays(dateTime , -1);
info(strFmt("New date time is %1", dateTime));
}
//Substract 1 day to Actual system date DateTimeUtil::addDays(DateTimeUtil::getSystemDateTime(),-1) //Add 1 Month to Actual system date DateTimeUtil::AddMonths(DateTimeUtil::getSystemDateTime(),-1)
No comments:
Post a Comment