+ Start a Discussion
LavieLavie 

DateTime not handling GMT correctly

I defined a custom datetime field for Cases.

Using .NET and sforce 3.0, I updated the field with a correct GMT value (I checked it at runtime with the debugger). However, when I view the date in the regular Salesforce CRM, the datetime is the "opposite" of my time zone. In other words, I am GMT +3:00, and the time shown is 03.00 AM instead of 06.00 (the correct value). This is curious, as since I am at GMT+3, I would have expected a mistake (if any) in my taking timezones into account would have caused 09.00 AM to have been displayed.

I'd appreciate help on this.

My environment is VS.NET 2003, c#.

zakzak
The SOAP stack in .NET expects all datetimes to be in localtime, not GMT. If you're passing a datetime that's already in GMT, then your GMT offset will get applied twice, causing the problem you're seeing. [This is because System.DateTime doesn't keep track of a timezone for the time value]

Cheers
Simon
LavieLavie

Simon - thanks!

Although this bizarre behavior isn't Salesforce's fault, it would have been nice if it had been documented in the API documentation...

zakzak

Lavie wrote:

Simon - thanks!

Although this bizarre behavior isn't Salesforce's fault, it would have been nice if it had been documented in the API documentation...







I know where you're coming from on, on the other hand, soapware.org now lists 91 SOAP toolkits, should everyone who hosts a SOAP service have to document the gotcha's for all 91 toolkits ?