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 224,750 Super User 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 224,750 Super User 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.

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,663 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,750 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans