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 :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
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,

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

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

  • Suggested answer
    Hariharans87 Profile Picture
    3 on at

    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)

  • startax Profile Picture
    1,845 on at

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

    it is blank in debugger.

  • Hariharans87 Profile Picture
    3 on at

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

  • startax Profile Picture
    1,845 on at

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

  • Suggested answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    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.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans