Salesforce Apex Data Loader - Date values off by 1 day

Author - Webner

How can I ensure my dates are correct when loading with the Data Loader?

When loading data into date fields such as Opportunity Close Date using the Data Loader, the date displayed in the application is sometimes one day earlier/later than the date in the upload file.

The reason for this is that fields such as Close Date are actually date+time fields. When a date is loaded without specifying time, the time is defaulted to 00:00 – midnight. If Salesforce settings are in a time zone which is behind/ahead than that of the developer (user uploading data), date will be off by 1 day.

For example:

20 August 2008 00:00 in Paris is 19 August 2008 23:00 in London.

Similar issues can arise when daylight savings time begins or ends.

Two simple solutions to this problem are:

1. Specify a time as well as a date when loading dates using the Data Loader.

OR

2. Switch your PC’s time zone to target timezone before starting up the Data Loader.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *