Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2005

Tip: Looking for answers? Try searching our database.

Same TimeZone on Client as Server on specific data table columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Benjamin - 16 Jun 2005 17:52 GMT
Hi!

We are sending DataSets over web service. This is a world wide used
application, with web service consumers in different TimeZones.

The inbuilt .NET functionality that automaticly recalculate (based on
TimeZone difference) the values in Date-columns are nice for us in most cases.

Now we have identified a few data table columns, that should not be
recalculated on client - we want to show same date and time that is stored in
database. (I am not going to waste effort on explaining why.)

Of course I understand that one solution is that each time these value are
substracted/displayed from the data set, I manually add or subtract the time
difference and display it to user. This is very bad solution I think. I want
to make some more general setting on that column (or on all values in that
column) so that when this is done I do not have to think about any more. I
mean that then all data displayed from this column is transparantly shown
with server TimeZone.

Best regards,
Benjamin, Sweden
"Peter Huang" [MSFT] - 17 Jun 2005 07:31 GMT
Hi

Based on my research, this is a limitation.

Further, it turns out that forcing the System.XML.Serialization serializer
to encode a date value in GMT on the wire is not possible in .NET, at least
not today.

The Special Case of XML
Several people I've talked to recently had the design goal of serializing
time values over Web services such that the XML that represents the
DateTime would be formatted in GMT (e.g., with a zero offset). While I've
heard various reasons ranging from the desire to simply parse the field as
a text string for display in a client to wanting to preserve the "stored in
UCT" assumptions that exist on the server to the callers of Web services,
I've not been convinced that there is ever a good reason to control the
marshalling format on the wire to this degree. Why? Simply because the XML
encoding for a DateTime type is perfectly adequate for representing an
instant in time, and the XML serializer that is built into the .NET
Framework does a fine job of managing the serialization and deserialization
issues associated with time values.

Further, it turns out that forcing the System.XML.Serialization serializer
to encode a date value in GMT on the wire is not possible in .NET, at least
not today. As a programmer, designer, or project manager, your job then
becomes making sure that the data that is being passed in your application
is performed accurately with a minimum of cost.

Several of the groups I talked with in the research that went into this
paper had adopted the strategy of defining special classes and writing
their own XML serializers so that they have full control over what the
DateTime values on the wire looked like in their XML. While I admire the
pluck that developers have when making the leap into this brave
undertaking, rest assured that the nuances of dealing with daylight savings
time and time zone conversion issues alone should make a good manager say,
"No way," especially when the mechanisms provided in the .NET Framework do
a perfectly accurate job of serializing time values already.

There is only one trick you have to be aware of, and as a designer you MUST
understand this and adhere to the rule (see Rule #5).

Coding Best Practices Using DateTime in the .NET Framework
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/datetimecode.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Benjamin - 21 Jun 2005 07:18 GMT
Hi!

We see no manageble way to work with DateTime format, in our case.
We are going to convert the database column to string,
and send strings over web services and present strings in clients.

Thanks anyway.

Benjamin,
Sweden
"Peter Huang" [MSFT] - 21 Jun 2005 08:19 GMT
Hi

Yes, so far this is a limitation, that the XML serializer will do the
datetime convert on which webservice is based.
So far, the workaround to that, is to define that column as a string
column, so that the xml serializer will consider it as a common string.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Benjamin - 13 Dec 2005 10:44 GMT
Now almost a year later, I would like to know if there are some news about
this (i e disabling time zone adjustment when sending data sets over web
services)in .NET Framework 2.0.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.