SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Daylight Davings Time
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MikaSa
Starting Member

7 Posts

Posted - 04/10/2012 :  17:22:24  Show Profile  Reply with Quote
I am using Visual Studio 2008 to create reports from an Oracle database.
Is there a way to have the report adjust for DST without having to go back in and change the query when DST changes. The reports have to go thru a validation process so it is not convienentt to have to change the query when DST changes.
I am looking for just the Hour and minutes.
I currently use the follow query

TO_CHAR(v.VISIT_DATETIME, 'HH24:MI:SS') Arrival_Time,

But since we are in DST it is off by one hour

Thanks

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 04/10/2012 :  17:29:27  Show Profile  Reply with Quote
I think this would be hard to do for a number of reasons:
a) depending on where you are (Arizona?) they may not be observing daylight savings;
b) depending on the year, the date on which daylight savings time changed may change. (They changed the dates in 2007?)

If you are looking just for the current time, rather than historical data stored in a table, you can compute the difference between UTC time and local time to find out how many hours to offset:
DATEDIFF(hh,GETUTCDATE(),GETDATE())
Go to Top of Page

MikaSa
Starting Member

7 Posts

Posted - 04/10/2012 :  18:08:13  Show Profile  Reply with Quote
Unfortunately I am looking to retrieve the time stamp in the database. The time stamp displyas correctly in sql developer but that is an oracle product. The time just gets lost in translation.
Do you think that it would be possible to pass the date as a parameter and have the parameter based on an iif statement. If this is possible I could set the statement for lets say 5 years forward and back and not have to worry about the validation process for a while.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000