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 6

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!

  • @rp@n Profile Picture
    6 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    thanks Jay

  • Martin Dráb Profile Picture
    231,833 Most Valuable Professional on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    @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?

  • Jay Barot Profile Picture
    1,502 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

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

  • @rp@n Profile Picture
    6 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    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.

  • Verified answer
    Jay Barot Profile Picture
    1,502 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    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
    6 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    Hi Martin,

    excel3.jpg

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

  • Suggested answer
    Jay Barot Profile Picture
    1,502 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

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

  • Martin Dráb Profile Picture
    231,833 Most Valuable Professional on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    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?

  • Jay Barot Profile Picture
    1,502 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    can you show screenshot of full code.

  • @rp@n Profile Picture
    6 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    thanx Jay,

    i did that but got below error...

    excel2.jpg

    please give me more shed on this.

    thanks!

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,833 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans