DateTime value in DataSet changed over remoting boundaries.

We are using .Net remoting(.Net framework 2.0) to pass DataSet from application server to web server.
It was noticed that if DateTime field in DataSet has '2008-10-26 02am" value, during remoting it is changed to '2008-10-26 03am".
I beleive that it is somehow relates to Daylight Saving time change. We didn't noticed any changes for other DateTime values.
According to  http://www.worldtimezone.com/daylight.html  Western Australia (Perth)  has time change 26-Oct, 02:00h.
However the servers with the problem noticed are located in Melbourne and Sydney, that have different date for Daylight Saving time change.(See also http://wwp.greenwichmeantime.com/time-zone/australia/time.htm)
Furthermore my development machine doesn’t have this problem -'2008-10-26 02am" is transferred unchanged.
We haven't found any essential differences in settings between machines that have the problem and my deveopment machine. It may be related to some MS hotfix update(??). However other machines with and without .Net framework 2 SP1 have the same problem.
Update: Reader of my post asked how to send DateTime values in a DataSet with DayLight saving considerration, but then pointed that .Net 2.0 and greater has ability to specify DataSetDateTime.Unspecified  enum value(“Serialization in this mode does not cause an offset”)  in DataColumn.DateTimeMode Property. It will make DateTime values in a dataset predictable regardless of server local time settings.
Also note that in .Net 3.5 there is TimeZoneInfo Class that suppose to help with cross-zone issues.

posted @ Wednesday, January 23, 2008 9:31 AM

Print

Comments on this entry:

# re: DateTime value in DataSet changed over remoting boundaries.

Left by Oscar at 2/20/2008 5:50 PM
Gravatar
I used the article you mentioned with an app in .Net 2.0 and worked fine. I included another case to the method

case DataRowState.Detached: AdjustDateTimeValues(row, ColumnNumbers, ColumnNumbersIndex, timespan, LocalTimeSpan);
DataRowState.Modified.
Debug.Assert(row.RowState == DataRowState.Detached);
break;

and added a verification of the type in the second method

if (row[columnIndex] is DateTime){
DateTime original = (DateTime)row[columnIndex];
original = original.Subtract(LocalTimeSpan);
DateTime modifiedDateTime = original.Add(timespan);
row[columnIndex] = modifiedDateTime;
}

# re: DateTime value in DataSet changed over remoting boundaries.

Left by Michael Freidgeim at 2/20/2008 9:44 PM
Gravatar
Oscar,
Thank you for sharing the code.

# re: DateTime value in DataSet changed over remoting boundaries.

Left by web development company at 8/13/2009 3:35 AM
Gravatar
thanks for the article I used it with .net 3.5 and it works fine.thanks for sharing the code

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345