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 :
Dynamics 365 Community / Forums / Finance forum / How to convert the Dat...
Finance forum

How to convert the Date field to the Date Time

(0) ShareShare
ReportReport
Posted on by 534

Hi Guys,

How to convert the "Date" field to the "dateTime" Field using X++ in d365.

  • Suggested answer
    Martin Dráb Profile Picture
    240,805 Most Valuable Professional on at

    Use DateTimeUtil::newDateTime(). The first parameter is a date, the second is a time of day (0 in your case) and the third one is the timezone - think about what timezone was the date based on.

  • Blue Wang Profile Picture
    Microsoft Employee on at

    Hi  Jenifer,

    There are many blogs for reference.

    For example:

    [View:https://www.tech.alirazazaidi.com/date-to-utcdatetime-convertion-dynamics-ax-2012/:750:50]

    [View:https://dynamicsaxposed.wordpress.com/2011/10/03/how-to-convert-from-date-to-utcdatetime/:750:50]

    [View:https://community.dynamics.com/365/financeandoperations/b/nevoitechfinance/posts/convert-date-and-time-to-utcdatetime-using-x:750:50]

  • Suggested answer
    Moeen Ahmed Sultan Profile Picture
    1,402 on at
  • duocprogrammer@gmail.com Profile Picture
    35 on at

    Hi Jenifer,

    This code x++ to convert Date to DateTime

    date _Date;

           _Date = 13\08\2019;

           utcdatetime test = DateTimeUtil::newDateTime(_Date, 0, DateTimeUtil::getCompanyTimeZone());

           info(any2Str(test));

    This is output:

    convert-date-to-datetime.png

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans