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 :
Microsoft Dynamics AX (Archived)
Answered

how to get the Date instead of Datetime in Ax 2012 r3

(0) ShareShare
ReportReport
Posted on by 1,737

I am writing the code to get the data from ax in to excel, but date field is coming is like as 01-05-2016 10:23:34

i want only date..

*This post is locked for comments

  • Martin Dráb Profile Picture
    240,854 Most Valuable Professional on at

    You can easily convert datetime to date, but I can't comment on your code, because you didn't tell us anything about it. Also you can change the format in Excel.

  • Mea_ Profile Picture
    60,286 on at

    Hi srinivas pamidi,

    You can use DateTimeUtil::date() to convert date time to date in x++ code.

  • srinivas pamidi Profile Picture
    1,737 on at

    Hi ievgen Miroshnikov,

    In Debugger it is showing Date in excel sheet it is showing as Date time.

    I am already Try this But it is Showing Error.

    Argument 't' is incompatable with the required type.

    xlsWorkSheet.cells().item(row,2).value(DateTimeUtil::date(budgetTmpBalanceLocal.Period));

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    budgetTmpBalanceLocal.Period is already a date so you cannot convert date to date.

    Could you please try to use xlsWorkSheet.cells().item(row,2).value(strfmt('%1', budgetTmpBalanceLocal.Period));

  • Suggested answer
    Community Member Profile Picture
    on at

    This will work :)

    xlsWorkSheet.cells().item(row,2).value(date2Str(budgetTmpBalanceLocal.Period, 123, 2, DateSeparator::Hyphen, 2, DateSeparator::Hyphen, 2,true));

    Output:

    01-05-2016

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans