Time Zones

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We want to disable the auto localization of DateTime's in DataSets. It's
actually nice that deserialization converts the datetime values to your local
time zone but we need to show data as it's in the database. It looks like
there is no easy way to handle this.
My question is can we somehow change the time zone within the application?
We don't want to alter the computer's time zone but we only want to override
this value in our app.

Thanks
 
Hi Mach,

Thanks for your posting!!

First, I think there are 2 understanding of your problem:
#1, You want to display the database datetime value in certain localization
format
#2, You want the datetime in the database to be universal time, which will
not be considered as a local time.

For #1, we may control this at UI side, with certain format string
For #2, yes, if the datetime value we stored does not have any universal
time mark, ADO.net will treat it as local stored, and just use local
timezone to parse it. For this issue, when storing data into the database,
we should use DateTime.ToUniversalTime to convert the datetime to universal
time, then store it into the database, then the datetime will have
universal mark, which will make the datetime universal not local.

Hope this helps.
===================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

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.
 
Back
Top