+ Start a Discussion

email to apex date field



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) 
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.