You need to sign in to do that
Don't have an account?
Healthone
Timezone problem with DateTime
Hi,
We are accessing Salesforce API in .NET
One of the object we are saving from the SF API has a DateTime field. It seems that due to timezone differences between the SF User ( GMT + 11 ) and the host server of .NET application ( GMT ) is causing wrong DateTime being saved in the SF.
Any way to force saving DateTimes as entered wihtout timezone information / adjustment?
Regards
We are accessing Salesforce API in .NET
One of the object we are saving from the SF API has a DateTime field. It seems that due to timezone differences between the SF User ( GMT + 11 ) and the host server of .NET application ( GMT ) is causing wrong DateTime being saved in the SF.
Any way to force saving DateTimes as entered wihtout timezone information / adjustment?
Regards
SF stores the date time in GMT/UTC timezone.
It depends on the user settings which user has set, which decides the timezone to be displayed. Change your user settings to GMT+11 and you can see the exact value which you are passing to .NET
In Apex:
SomeObject1.DateTime__c = '13/10/2014 14:41:20'; //maybe wrong syntax but understandable
In .NET
SomeObject2.DateTime__c = new DateTime(13,10,2014,14,41,20); // maybe wrong syntax but understandable
Why does the SomeObject2.DateTime__c is shown with 11 hours ahead in the Salesforce where as SomeObject1.DateTime__c is shown exactly how it was saved from Apex ?
TimeZone tz = UserInfo.getTimeZone();
Datetime valueToInsert = Datetime from ,Net - tz.getOffset(Datetime from ,Net);
Finally use 'valueToInsert' too populate in fileld.
Thanks.