Hi,
I have the following:
str dateString = "Sunday, 21 Feb 2010 19:05:15 GMT"
how can i convert this to UTCDateTime?
Hi junior AX,
Please refere to this 2 links, you will find your answer:
String format options for UtcDateTime:
dev.goshoom.net/.../
Working with utcDateTime Functionality in Dynamics AX 2012 :
stoneridgesoftware.com/.../
Hi
Dynamics AX 2012 utilizes the utcDateTime data type to store date time information in the database using the Greenwich Mean Time definition of time. This allows the data to be date stamped in a manner that does not reflect the client or AOS time zone (this date/time stamp is considered to be time zone agnostic).
DateTimeUntil class: https://docs.microsoft.com/en-us/previous-versions/dynamics/ax-2012/system-classes/gg837448(v=ax.60)?redirectedfrom=MSDN
static void DateConvert(Args _args){ UTCDateTime myDateTime,gmtDateTime; str strDate; //The sequence 123 describes the position of day (1), month (2), year (3). int intSeq; Timezone myTimeZone = Timezone::GMTPLUS0800BEIJING_CHONGQING_HONGKONG; ; // Sunday, 21 Feb 2010 19:05:15 GMT strDate = "21 Feb 2010 19:05:15"; intSeq = 123; myDateTime = str2datetime(strDate,intSeq); info(strFmt("datetime in GMT: %1",datetime2str(myDateTime))); myDateTime = DateTimeUtil::applyTimeZoneOffset(myDateTime,myTimeZone); info(strFmt("datetime in GMT+8: %1",datetime2str(myDateTime))); //myDateTime = str2datetime(strDate,intSeq); gmtDateTime = DateTimeUtil::removeTimeZoneOffset(myDateTime,myTimeZone); info(strFmt("datetime in GMT: %1",datetime2str(gmtDateTime)));}
HI Junior,
You can convert RFC1123 string time format to DateTime,and then convert it to UTCDateTime.
DateTime zdt = DateTime::Parse("Thu, 25 Aug 2016 08:59:00 GMT" ); udateTime = Global::CLRSystemDateTime2UtcDateTime(zdt);
Please refer this thread: https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/125802/converting-string-into-datetime
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Sohaib Cheema 775 User Group Leader
Martin Dráb 634 Most Valuable Professional
André Arnaud de Cal... 622 Super User 2025 Season 2