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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

how to remove ( time from date ) in excel during exporting form AX

(0) ShareShare
ReportReport
Posted on by 30

Hi All,

Can you please let me know, i did code for excel export. it's bring data nicely.

I noticed the problem in date fieldS...

excel1.jpg

In above marked 2 columns showing value with datetime

the above 2 columns date field in AX is simply trans date datatype like...

purchLine.DeliveryDate;

purchLine.ConfirmedDlv;

i wrote below code -

excelWorksheet.cells().item(i,7).value(deliveryDate);
excelWorksheet.cells().item(i,8).value(ConfirmedDlv);

@ but in excel it showing date with time. Is it any way that i can control from AX to remove time before export in excel ?

Please give me more shed on this.

Thanks!

I have the same question (0)
  • Suggested answer
    Jay Barot Profile Picture
    1,502 on at

    Hi @rp@n,

    Please use this code: date2str(DateTimeUtil::date(purchLine.DeliveryDate),123,2,DateSeparator::Hyphen,2,DateSeparator::Hyphen,4)

  • @rp@n Profile Picture
    30 on at

    thanx Jay,

    i did that but got below error...

    excel2.jpg

    please give me more shed on this.

    thanks!

  • Jay Barot Profile Picture
    1,502 on at

    can you show screenshot of full code.

  • Martin Dráb Profile Picture
    237,912 Most Valuable Professional on at

    Is it true that the only problem is that time is being added? Do you really have all dates set to 2.1.1900? It looks unlikely to me.

    What value do you get for the current day, for example?

  • Suggested answer
    Jay Barot Profile Picture
    1,502 on at

    Hi @rp@n,

    Delivery date is not datetime field. Suggestion i have given will work for datetime fields. So you can use the code as below

    date2str(purchLine.DeliveryDate,123,2,DateSeparator::Hyphen,2,DateSeparator::Hyphen,4);

  • @rp@n Profile Picture
    30 on at

    Hi Martin,

    excel3.jpg

    i purchline, its showing date only but in excel it showing with time

  • Verified answer
    Jay Barot Profile Picture
    1,502 on at

    Use this line of codes

    date2str(purchLine.DeliveryDate,123,2,DateSeparator::Hyphen,2,DateSeparator::Hyphen,4);

    date2str(purchLine.ConfirmedDlv,123,2,DateSeparator::Hyphen,2,DateSeparator::Hyphen,4);

  • @rp@n Profile Picture
    30 on at

    now i understand , why this error is appearing

    i tested with modifieddatetime datatype - utcdatetime

    test = date2str(DateTimeUtil::date(purchLine.modifiedDateTime),123,2,DateSeparator::Hyphen,2,DateSeparator::Hyphen,4);

    working fine

    but issue with deliverydate because this is  date field and in parameter i need to pass utcdatetime.

    so, the above code is not suitable for deliverydate field.

  • Jay Barot Profile Picture
    1,502 on at

    Yes. That's why i have sent appropriate code for that in previous reply.

  • Martin Dráb Profile Picture
    237,912 Most Valuable Professional on at

    @rp@n, you merely repeated the same thing that I was reacting to. Could you please read my reply again and then answer the questions?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans