Trying to insert a Contact from an Oracle Database:

Contact Database Entity:

private Date dob;

Contact SOAP SObject set Birthday:

Calendar dobCalendar = new GregorianCalendar();
contact.setField("Birthdate", dobCalendar);

Error Message:

ERROR CODE: FIELD_INTEGRITY_EXCEPTION MESSAGE: Birthdate: invalid date: Fri Nov 30 00:00:00 GMT 3

Any suggestions?

  • what soap stack ore you using?
    – superfell
    Commented Dec 3, 2013 at 18:43
  • Partner Connection Commented Dec 3, 2013 at 18:44

2 Answers 2


According to the Salesforce SOAP API guide setField takes a Java Calendar object.

The following is using v29 of the WSC Partner API.

    com.sforce.soap.partner.sobject.SObject record = new SObject();
    record.setField("Date__c", Calendar.getInstance());
    record.setField("NewDate__c", Calendar.getInstance());
    SaveResult[] result = connection.create(new SObject[] { record });

The following results in the following for me

enter image description here

The above two fields are defined as Date and DateTime as follows...

enter image description here

enter image description here


You are passing in the wrong date format. If you run the below code in an execute anonymous window you will see the format that SF is expecting

Contact c = [Select Id, Birthdate From Contact Where Birthdate != null limit 1];
system.debug('Date Format Example: ' + c.Birthdate);


13:09:36.051 (51068646)|USER_DEBUG|[2]|DEBUG|Date Format Example: 1946-03-19 00:00:00

You need to try to adjust your date format prior to trying to set the Birthdate field

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .