You need to sign in to do that
Don't have an account?
moeoo
Time zone difference
Hi All
I'm trying to create datetime field by C# .Net code.
I'm in Australia and time zone is in (GMT+10:00) Eastern Standard Time (New South Wales). The datetime is created on salesforce in different format (Probably US format).
For example, my datetime in the database is 29/08/07 but when it is inserted on salesforce, it's being changed to 30/08/07.
I found the getServerTimestamp() method but I'm not sure this is the right way to do it and if so, how can I get the datetime inserted right?
Thanks in advance
Moe
From Salesforce,
public static DateTime ToLocalDateTime(DateTime date)
{
DateTime dtReturn = new DateTime(1900, 1, 1);
try
{
TimeZone objTimeZone = TimeZone.CurrentTimeZone;
TimeSpan objTimeSpan = objTimeZone.GetUtcOffset(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day));
dtReturn = date.Add(objTimeSpan);
}
catch
{
dtReturn = new DateTime(1900, 1, 1);
}
return dtReturn;
}