Tuesday, February 9, 2010

Conversion of UTCDateTime in D365 Finance and Operation / D365 F&O

Recently I have faced a problem of conversion from UTCDateTime variable. I searched everywhere blogs, msdn & finally got result.I am really thankfull for www.axaptapedia.com/UtcDateTime blog for the refference. This job is indicating converting from UTCDateTime to seperate variables as well as seperate variables to UTCDateTime variable.

public static void RAJ_UTCDateTimeConversion()
{
UTCDateTime dateTime;
date tmpDate;
TimeOfDay tmpTime;
CustTable cTable = CustTable::find("1101");
;

// Extracted date & Time from UTCDateTime datatype to individulal variable
dateTime = cTable.createdDateTime;

tmpDate = DateTimeUtil::date(dateTime);
tmpTime = DateTimeUtil::time(DateTimeUtil::applyTimeZoneOffset(dateTime, DateTimeUtil::getUserPreferredTimeZone()));

info(strfmt("Date: %1 and Time: %2.", tmpDate, time2str(tmpTime,1,2)));


// assign UTCDateTime varriable by using two individual field
dateTime = DateTimeUtil::newDateTime(12\05\2010, timeNow());
info(strfmt("UTCDateTime: %1.",dateTime));
}

1 comment:

ignadoyamazaki said...

Top 10 slot machines in Palm Springs | Mapyro
Check out our top 경상남도 출장마사지 10 부천 출장샵 slot machines in 시흥 출장샵 Palm Springs, along with a list of 보령 출장샵 recommended 영주 출장마사지 casinos in Palm Springs, including recommended RV Park locations.