[SalesForce] Java sql.TimeStamp to Salesforce

I have a Java mapping that takes a field of type java.sql.Timestamp and insert it into Salesforce. Example of a field in the db:

2013-10-17 13:01:01

When it is inserted into Salesforce it looks like:

10/16/2013 5:00 PM

How do I fix it that it inserts the date as 10/17/2013 1:01 PM?

Here is how I set the field and getModifyD us returned as java.sql.Timestamp

clientNotesSObject.setType("Task");
caseSObject.setField("Client_Modified_Date__c", clientNote.getModifyD());

Best Answer

When dealing with DateTime values in the Salesforce API they should be sent in ISO 8601 format with the UTC value.

Salesforce will change the value displayed in the UI based on the current users UTC offset.

Assuming your sample data is in the Coordinated Universal Time (UTC) time zone, it would be:

2013-10-2013T13:01:01.000Z

See also: Primitive Data Types - dateTime