Hi Giri,
I think a sample and easy to implement way of avoiding the timezone
conversion is convert the Datetime object to string, then in client side,
you can again convert the string into DateTime object.
If you want to do the timezone conversion, I think you should store the UTC
in server side and use tolocal method in client side.
Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: "Giri" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: Re: DateTime time zone conversions not required !
| Date: Tue, 21 Oct 2003 09:21:52 +0100
| Lines: 34
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 193.67.177.98
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:192793
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| What is interesting is the following:
|
| The database has a date as 10 Oct 1999 00:00 (ie midnight)
|
| A webservice in CET (GMT+1) plucks this out of the database into a typed
| dataset.
|
| If you go direct to the webservice from a browser and use the VS.NET
harness
| you see the right date.
|
| A component in a different timezone GMT receives this typed dataset. When
| you then access the typed dataset's date field it has become.... 11 Oct
| 1999 22:00. Now this is strictly speaking correct as that is the time GMT
| if you take daylight saving into account...
|
| My problem is that all my dates are in as midnight... I don't care about
| the "time" as such so converting to and from UTC is not realistic as the
| dates when entered by the user into the system are specified as just dates
| not daae and time in their timezone....
|
| Luckily for me .Subtract returns a TimeSpan object, whose Days property is
| returning the correct result (can you confirm this ?).
|
| This doesn't resolve whether I should be :
|
| a) Letting dates go in as midnight but then use .ToLocalTime() in the
| timezone.
| b) Engage in the complexity of dealing with time and convert to UTC on the
| way in and ToLocal on the way out..
| b) Any other strategy...
|
| Be grateful for any advice on this.
|
|
|