On the surface, it appears to me that the clients should convert all date/times to UTC before sending to the server and that they
should convert all received date/times from UTC to local before displaying. The server would only store/retrieve UTC times.
I don't have a clue why the date time fields in the datasets are getting converted for you, but I think you can live with that as
long as it works consistently. Let the automatic conversion happen where you have datasets and do the manual conversion the rest
of the time.
[quoted text, click to view] On 2 Aug 2005 00:28:41 -0700, "PromisedOyster" <PromisedOyster@hotmail.com> wrote:
>We have a client/server WinForms/C# application that uses .NET Remoting
>for the middleware. There is a SQL Server database at the back-end. (I
>believe that the same issue exists with WebServices).
>
>The server machine is in one time zone. Some users are in another time
>zone. They connect to the server using .NET Remoting and data is stored
>in a SQL Server database.
>
>If we pass Typed DataSets across the wire then DateTime columns within
>the Typed DataSet work well, presumably because of the Locale property
>on the DataSet. ie the date in the database is the local date/time and
>the date on the records that are returned to/from the client are in
>local time.
>
>However, there are couple of other instances where this model does not
>work:
>
>(1) Passing simple C# DateTime structs across the server boundary do
>not convert to the correct time zone. There is no conversion to the
>local time zone, so the data held may be a few hours out.
>
>(2) When we use DateTime columns to store Date only values. eg
>'12/2/2000 00:00:00' gets presented as '12/1/2000 21:00'
>
>What are the options to get around this problem?
>
>(1) can be solved by us passing datasets across the wire, but means
>additional load which we could possibly wear.
>
>I beleive that UTC is a way around (2). However, I am uncertain as to
>why '12/2/2000 00:00:00' in the dataset in the client time zone, then
>gets stored exactly the same in the database in the different server
>time zone (ie NO conversion) which is good BUT when retrieving, a
>conversion takes place causing no end of confusion.
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.