<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlserver.ro/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>T-SQL</title><link>http://sqlserver.ro/forums/15/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9161.aspx</link><pubDate>Tue, 06 Mar 2012 18:51:11 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9161</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9161.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9161</wfw:commentRss><description>Yep. Asta rezolva cam totul :).&lt;br /&gt;&lt;br /&gt;In concluzie, se incarca baza aceea de date in sql server, dupa care se foloseste functia switchoffset(datetimeoffset, timezone). &lt;br /&gt;Atunci cand se da timezone-ul ca parametru, se adauga +1 daca dst este activ, atlfel nu.&lt;br /&gt;&lt;br /&gt;In cazul in care se doreste convertirea unei coloane de tip datetime la datetimeoffset, mergand pe ideea ca au fost introduse de pe serverul pe care se face si convertirea adica timezone-ul dupa care sa facut getdate() a fost intotdeauna acelasi, se poate folosi functia TODATETIMEOFFSET(datetime,offset). &lt;br /&gt;&lt;br /&gt;Pentru a obtine offsetul serverului curent se foloseste datepart(tz,SYSDATETIMEOFFSET()).&lt;br /&gt;&lt;br /&gt;Mentionez ca toate acestea sunt doar pentru sqlserver 2008 si peste.&lt;br /&gt;Mersi pentru ajutor si sper sa ajute si pe altcineva acest thread.</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9160.aspx</link><pubDate>Tue, 06 Mar 2012 18:30:38 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9160</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9160.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9160</wfw:commentRss><description>Poate te ajută următorul articol publicat de către&amp;nbsp; SQL Programmability &amp;amp; API Development Team:&lt;br&gt;&lt;a href="http://blogs.msdn.com/b/sqlprogrammability/archive/2008/03/18/using-time-zone-data-in-sql-server-2008.aspx"&gt;Using time zone data in SQL Server 2008&lt;/a&gt;&lt;br&gt;&lt;br&gt;Autorul a folosit o bibliotecă .Net (&lt;a href="http://www.babiej.demon.nl/Tz4Net/main.htm"&gt;&lt;b&gt;&lt;font face="Arial"&gt;TZ4Net Library&lt;/font&gt;&lt;/b&gt;&lt;/a&gt;) pentru a citi datele din "baza de date Olson". Ulterior, aceste date sunt scrise în două fişiere *.txt (separator \t) care pot fi importate uşor în SQL Server folosind SSMS &amp;gt; Import data ... sau SSIS. Nu am testat soluţia.&lt;br&gt;</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9159.aspx</link><pubDate>Tue, 06 Mar 2012 16:17:21 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9159</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9159.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9159</wfw:commentRss><description>am aruncat o privire pe acea baza de date, dar cum as putea sa o translatez intr-o baza de date sql ? Exista un tool sau ceva ?</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9158.aspx</link><pubDate>Tue, 06 Mar 2012 14:06:39 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9158</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9158.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9158</wfw:commentRss><description>Pe stackoverflow este o discuţie pe tema TZ / DST aici:&lt;br&gt;&lt;a href="http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices"&gt;http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices&lt;/a&gt;&lt;br&gt;&lt;br&gt;O "bază de date" (Olson database / Tz_database) poate fi găsită aici:&lt;br&gt;&lt;a href="http://www.iana.org/time-zones"&gt;http://www.iana.org/time-zones&lt;/a&gt;&lt;br&gt;</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9157.aspx</link><pubDate>Tue, 06 Mar 2012 14:05:22 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9157</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9157.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9157</wfw:commentRss><description>Timezone-urile pe care le cunoaște Windows sunt &amp;#238;n registry, la HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.&lt;br /&gt;Apare acolo și data la care se face trecerea la Daylight Saving Time, &amp;#238;n format binar, documentat la:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Răzvan</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9156.aspx</link><pubDate>Tue, 06 Mar 2012 13:51:43 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9156</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9156.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9156</wfw:commentRss><description>Din cate am observat DST se activeaza si se dezactiveaza in mod diferit pe diferite regiuni. de ex : in USA DST  se activeaza pe 11 martie, iar in RO DST se activeaza pe 25 martie.&lt;br /&gt;&lt;br /&gt;Am incercat sa gasesc o tabela cu toate timezone-urile care sa contina si daca DST se aplica, cand se activeaza si cand se dezactiveaza dar  nu am reusit.&lt;br /&gt;&lt;br /&gt;Aveti idee cum as putea sa obtin o astfel de informatie ?</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9155.aspx</link><pubDate>Tue, 06 Mar 2012 13:31:53 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9155</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9155.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9155</wfw:commentRss><description>Si te rog spune-mi la ce solutie ai ajuns in final. E o problema interesanta :)</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9154.aspx</link><pubDate>Tue, 06 Mar 2012 13:31:14 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9154</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9154.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9154</wfw:commentRss><description>Incearca sa faci un tabel / mai multe tabele de setari / lookup pornind de aici:&lt;br /&gt;http://www.timeanddate.com/library/abbreviations/timezones/&lt;br /&gt;Pentru fiecare server poti sa iei datele privind time zone-ul aferent si sa le folosesti ulterior, tinand seama si de datele pe care le calculezi cu functia din articolul lui Tim Cullen.&lt;br /&gt;</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9152.aspx</link><pubDate>Mon, 05 Mar 2012 19:27:36 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9152</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9152.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9152</wfw:commentRss><description>Din pacate, in aceasta situatie nu.&lt;br /&gt;Cerinte sunt ca totul sa fie in sql server.&lt;br /&gt;&lt;br /&gt;Cred ca e asa : Serverul are un timezone pe care il obtin "select datepart(tz,sysdatetimeoffset())". Timezone-ul dat ca parametru sa zicem ca este +2:00 si pentru el se aplica DST ( de observat ca nu pentru toata tarile se aplica DST ). Daca pentru timezone se aplica DST si DST este activ atunci cred ca timezone-ul trebuie sa fie +3:00. Dupa aceea se face switchoffset(getdate() /*asta fiind getdate() de pe server*/, [TZ dat ca parametru peste care este aplicat sau nu DST] - [TZ serverului]) si am obtinut data pentru timezone-ul oferit ca parametru.&lt;br /&gt;&lt;br /&gt;Cam asta am inteles eu :). Intrebarea este daca este corect ceea ce am descris mai sus, si cum stiu si eu toate timezone-urile la care se aplica sau nu DST.&lt;br /&gt;Nu m-ar deranja sa le harcodez intr-o tabela sau ceva, dar de unde le iau ? &lt;br /&gt;&lt;br /&gt;Dar mai discutam maine.&lt;br /&gt;&lt;br /&gt;Mersi,</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9151.aspx</link><pubDate>Mon, 05 Mar 2012 19:05:10 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9151</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9151.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9151</wfw:commentRss><description>Citesc si eu si mai discutam maine.&lt;br /&gt;Nu poti "actiona" la nivelul aplicatiei - adica nu poti afisa ora corecta folosind cod de .NET, de exemplu?</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9150.aspx</link><pubDate>Mon, 05 Mar 2012 18:57:16 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9150</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9150.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9150</wfw:commentRss><description>l-am vazut, l-am citit.&lt;br /&gt;Nu pot folosi clr din pacate. Trebuie sa fie doar sql.&lt;br /&gt;&lt;br /&gt;Am gasit http://www.mssqltips.com/sqlservertip/1372/daylight-savings-time-functions-in-sql-server/ care te ajuta sa stii daca este activat DST sau nu. Folosind aceasta functie, cred ca pot folosi si SWITCHOFFSET. Functia asta primeste un parametru time_zone.&lt;br /&gt;&lt;br /&gt;conform cu msdn time_zone : "Is a character string in the format [+|-]TZH:TZM or a signed integer (of minutes) that represents the time zone offset, and is assumed to be daylight-saving aware and adjusted."&lt;br /&gt;&lt;br /&gt;Insa nu stiu cum sa ii pasez parametru. Adica sa il ajustez in functie de DST.&lt;br /&gt;</description></item><item><title>Re: timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9149.aspx</link><pubDate>Mon, 05 Mar 2012 18:47:07 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9149</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9149.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9149</wfw:commentRss><description>Vezi daca te ajuta&lt;br /&gt;http://www.mssqltips.com/sqlservertip/2339/converting-utc-to-local-time-with-sql-server-clr/&lt;br /&gt;</description></item><item><title>timezone offset and dst</title><link>http://sqlserver.ro/forums/thread/9148.aspx</link><pubDate>Mon, 05 Mar 2012 18:29:56 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:9148</guid><dc:creator>tebbaerty</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/9148.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=15&amp;PostID=9148</wfw:commentRss><description>Salut,&lt;br /&gt;&lt;br /&gt;Sunt inca incepator pe aceasta parte. Cum se poate, doar folosind sqlserver, sa deduc timezone-ul serverului si dupa aceea sa obtin diferenta de ore dintre acesta si un alt timezone dar sa se tina cont si de DST.&lt;br /&gt;&lt;br /&gt;Mentionez ca folosesc sqlserver 2008.&lt;br /&gt;&lt;br /&gt;Am gasit cateva functii cum ar fi&lt;br /&gt;SWITCHOFFSET&lt;br /&gt;SYSDATETIMEOFFSET&lt;br /&gt;&lt;br /&gt;Dar nu stiu cum sa le folosesc astfel incat sa stie sa tina cont si de DST.&lt;br /&gt;Ma puteti ajuta cu un exemplu si cateva explicatii ?&lt;br /&gt;&lt;br /&gt;mersi,</description></item></channel></rss>