Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

UTC Date time to System Date time in X++

Posted on by 533

Hi Experts,

I need to display start date time and end date time from a table in my report which is of type UTCDateTime now. how can I convert it to user timezone datetime.

StartDate = MyTable.StartDate

EndDate = MyTable.EndDate

Is there any code to convert it directly. 

Thanks in advance. 

  • Suggested answer
    D365  beginner Profile Picture
    D365 beginner 533 on at
    RE: UTC Date time to System Date time in X++

    This works perfect. Thanks

  • Verified answer
    Blue Wang Profile Picture
    Blue Wang on at
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 225,672 Super User on at
    RE: UTC Date time to System Date time in X++

    The title says that you want to do it in X , but then you talk about a report. Can you clarify your needs, please?

    If you need it in X , use DateTimeUtil::applyTimeZoneOffset():

    DateTimeUtil::applyTimeZoneOffset(myTable.StartDate, DateTimeUtil::getUserPreferredTimeZone()));

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans