Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 17,808 of 19,505    |
|    Erland Sommarskog to Iain Sharp    |
|    Re: Dates and timezones    |
|    28 May 10 23:21:32    |
      XPost: microsoft.public.sqlserver.programming       From: esquel@sommarskog.se              Iain Sharp (iains@pciltd.co.uk) writes:       > I have an database with many datetime columns in many different       > entities.       >       > My application language has theoretically the facility to adjust the       > times based on the variation between the client locale and the server       > locale, but it's really buggy.       >       > Is there a feature I can use in SQL server 2005 which can apply the       > offset during insert update and select based on the database user       > log-in? (i.e. so that the dates are stored in GMT but as far as that       > database user is concerned they will be in USA(EST)?)       >       > I'm hoping that the application language will fix the bugs, allowing       > me to do this in the application, but until then, any ideas?              SQL Server has no information about the client's timezone. So if the       client is in New York, and sends in 2010-05-29 13:31 and this is -04:00,       there is no way you can no this in SQL Server with less than passing       the time zone from the client.              If you have the offset, dateadd will help you. But that is also all       you have.              In SQL 2008 there are some new datetime data types, including       datetimeoffset, so that you can store a time-zone value with the       datetime value.                     --       Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se              Links for SQL Server Books Online:       SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx       SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx       SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca