Thursday, March 1, 2012

Salesforce Date Primitive Data Type doesn't adjust to the user timezone

After rolling lots of UTC Date data up through the partner API I was initially puzzled why a user on PDT (UTC-8) would be seeing the same value in the Salesforce interface as a user on NZDT (UTC+13).

In hindsight this makes sense, a Date without time doesn't really have a sensible adjustment for UTC to the users timezone.

From Primitive Data Types:

Date data. Fields of this type contain date values, such as ActivityDate in the Event object. Unlike dateTime fields, date fields contain no time value—the time portion of a date field is not relevant and is always set to midnight in the Coordinated Universal Time (UTC) time zone.