RE: Time Zones

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jeffrey Tan[MSFT] (v-jetan_at_online.microsoft.com)
Date: 03/04/05


Date: Fri, 04 Mar 2005 06:20:27 GMT

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.



Relevant Pages

  • Re: DATE Format
    ... i Have a database in SQLserver. ... I am using php to connect to it and to retrieve data from that ... where can i change de that default format? ... I doubt if the column is DATATIME, it is more likely DATETIME. ...
    (comp.lang.php)
  • Re:Date Problem
    ... create table test(dt datetime) ... declare @dt varchar ... >database using asp.net. ... mm/dd/yyyy format. ...
    (microsoft.public.sqlserver.security)
  • RE: DateTime Parse and CultureInfo problem.
    ... any parsing when reading them from the database. ... The DateTime.ParseExact can only parse a string if the format is exactly as ... > String was not recognized as a valid DateTime. ...
    (microsoft.public.dotnet.framework)
  • Re: selecting records based on the position in the database
    ... >You have a date time stamp field? ... >ORDER BY dateTime DESC; ... >> I need to write a query for a database that needs to ...
    (microsoft.public.access.queries)
  • Re: Time data type
    ... >>If I create stored procedure and add parameter of datetime data type, ... >>What is the best vay, to store the time in sql database, which data type ... > handle the formatting - after all, the presentation layer is aware of the ...
    (microsoft.public.sqlserver.programming)