Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

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

Posted on by 5,901

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
    @rp@n 5,901 on at
    RE: how to remove ( time from date ) in excel during exporting form AX

    thanks Jay

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 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
    Jay Barot 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
    @rp@n 5,901 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
    Jay Barot 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
    @rp@n 5,901 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
    Jay Barot 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
    Martin Dráb 230,235 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
    Jay Barot 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
    @rp@n 5,901 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans