Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
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 on Wednesday, January 23, 2008 9:31 AM .Net Remoting | Back to top


Comments on this post: DateTime value in DataSet changed over remoting boundaries.

# re: DateTime value in DataSet changed over remoting boundaries.
Requesting 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;
}

Left by Oscar on Feb 20, 2008 5:50 PM

# re: DateTime value in DataSet changed over remoting boundaries.
Requesting Gravatar...
Oscar,
Thank you for sharing the code.
Left by Michael Freidgeim on Feb 20, 2008 9:44 PM

# re: DateTime value in DataSet changed over remoting boundaries.
Requesting Gravatar...
thanks for the article I used it with .net 3.5 and it works fine.thanks for sharing the code
Left by web development company on Aug 13, 2009 3:35 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net