DateTime values and Timezone

  • Thread starter Thread starter Robert Weiss
  • Start date Start date
R

Robert Weiss

We have dates in SqlServer stored with time not set
(00:00:0000).
Looking at the date with a .NET client (Winforms), the
displayed date depends on the timezone setting of the
client computer.
If there is a negative offset to GMT, the day before is
displayed.
Displaying the dates with the time part shows, that the
time offset is added (subtracted) to the original time.

Is there any way to display the correct dates ?
 
Hi Robert,
I think you can use the TimeZone.GetUtcOffset() method to get the offset
time and suitably display ...
alternatively, you can use the TimeZone.ToUniversalTime method to display
directly in UTC.

Hope this helps

-Diwakar
 
Hi Diwakar,
thanks for your reply.
Your suggested solutions should work.
But it's a dataset with few tables and a lot of columns...

Meanwhile I found out, that this problem comes with
remoting (serialization and deserialisation of datetime
values).
But it's stupid, who needs this ?
In our case the database server is in germany and the
client in USA puts in a date, and is shown the day
before, when data is refreshed...

Robert
 
Back
Top