Is there a way in Oracle to select the date on which daylight savings will switch over for my locale?
Something vaguely equivalent to this would be nice:
SELECT CHANGEOVER_DATE FROM SOME_SYSTEM_TABLE WHERE DATE_TYPE = 'DAYLIGHT_SAVINGS_CHANGEOVER' AND TO_CHAR(CHANGEOVER_DATE,'YYYY') = TO_CHAR(SYSDATE,'YYYY'); -- in the current year
Edit: I was hoping for a solution that would not require changes when Congress adjusts DST laws, as they did in 2007. The posted solutions will work, though.
We use the following two functions to calculate the start and end dates for any given year (post 2007, US).
There is probably a simpler way to do it, but these have worked for us. Of course this query doesn’t know whether daylight saving time is observed for where you are. For that you will need location data.