web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to convert string to UTCDateTime?

(0) ShareShare
ReportReport
Posted on by 1,552

Hi,

I have the following:

str dateString = "Sunday, 21 Feb 2010 19:05:15 GMT"

how can i convert this to UTCDateTime?

I have the same question (0)
  • zhifeng Profile Picture
    Microsoft Employee on at
  • Blue Wang Profile Picture
    Microsoft Employee on at

    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);

    8244.PNG

  • HenryXie Profile Picture
    Microsoft Employee on at

    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)));
    }

  • AdnDalhi Profile Picture
    336 on at

    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/.../

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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 465 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans