Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

How to get date from excel for Birthday in x++

Posted on by 1,845

i have a excel sheet  with birthday field (11/22/2015) i need to fill this in three field like for day = 22 , month = 11 and year = 2015 in sales and marketing / common / contacts.

i am trying to do like this

TransDate             birthDate

birthDate = (conPeek(readCon, 12));
                dirPerson.BirthYear = year(birthDate);
                dirPerson.BirthMonth = mthOfYr(birthDate);
                dirPerson.BirthDay = dayOfMth(birthDate);

but i am getting error in conversion of line  birthDate = (conPeek(readCon, 12));

plz provide me which function i have to used to convert it.

thank you,

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 228,493 Most Valuable Professional on at
    RE: How to get date from excel for Birthday in x++

    mthOfYr() already returns a number. You're probably confused by the fact that the field uses an enum (MonthsOfYear) and therefore users see a friendly name instead of the underlying integer value.

    You could use a display method returning int instead of MonthsOfYear, if you really want the number.

  • startax Profile Picture
    startax 1,845 on at
    RE: How to get date from excel for Birthday in x++

    hi hariharan i am almost reached to finish line .

    i am getting November from dirPerson.BirthMonth = mthOfYr(birthDate); this but i want 11 in digit not month name how do i get it??

  • Hariharans87 Profile Picture
    Hariharans87 4,971 on at
    RE: How to get date from excel for Birthday in x++

    What value you are getting in the container element conPeek(readCon, 12)?

  • startax Profile Picture
    startax 1,845 on at
    RE: How to get date from excel for Birthday in x++

    hi hariharan i am already tried it i t cant take any value when i am used str2date

    it is blank in debugger.

  • Suggested answer
    Hariharans87 Profile Picture
    Hariharans87 4,971 on at
    RE: How to get date from excel for Birthday in x++

    If you have the data in the container, try to use the str2date function for convert the str to date msdn.microsoft.com/.../aa554244.aspx.

    For example:

    str2Date(conPeek(readCon, 12), 123)

  • Martin Dráb Profile Picture
    Martin Dráb 228,493 Most Valuable Professional on at
    RE: How to get date from excel for Birthday in x++

    Please check what value is in the 12th element of readCon variable. We can't do it for you.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans