function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dkndkn 

email to apex date field

Hi

 

I have written an email to apex code , where a contact is created  as soon as an email is recieved to the email service depending on the email content.

 

Everything works fine , since all the value are string ...so it creates a contact.

 

The issue I am having is there a Birthdate field which is a date field, how can i pass this date field as a string to the system.

 

I would appreciate your help.

 

thank you

 

Best Answer chosen by Admin (Salesforce Developers) 
Jeremy.NottinghJeremy.Nottingh
newInstanceInteger year

Integer month

Integer date

DateConstructs a Date from Integer representations of the year, month (1=Jan), and day. The following example creates the date February 17th, 1960:
Date myDate = 
date.newinstance(1960, 2, 17);

 

Search on "date methods" in the Apex Developer's Guide.

 

Jeremy