Here is an example of correct conversion between UTCDateTime value and Date and Time value which is associated with user preferred time zone: public static void testDateTimeConversion() { utcDateTime dateTime; date dateInUserTimeZone; TimeOfDay timeInUserTimeZone; dateTime = DateTimeUtil::utcNow(); dateInUserTimeZone = DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(dateTime, DateTimeUtil::getUserPreferredTimeZone())); timeInUserTimeZone = DateTimeUtil::time(DateTimeUtil::applyTimeZoneOffset(dateTime, DateTimeUtil::getUserPreferredTimeZone())); dateTime = DateTimeUtil::newDateTime(dateInUserTimeZone, timeInUserTimeZone, DateTimeUtil::getUserPreferredTimeZone()); }
This blog is contains coding reference related to Microsoft AX 2012 and D365 finance and operations and Power platform
Friday, April 30, 2021
Conversion from UTCDateTime to Date or Time in AX
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment