Page 1 of 1

Next Daylight Saving Change Date

Posted: Sun Jun 10, 2012 6:56 am
by GSM
On one of my pages I have a reference to the next daylight saving change date. I used to update this page after every daylight saving time change but to simplify matters I created below UDT.

I think it's straight forward. The date format settings are for Austria/Europe and the daylight saving dates accordingly but can be adjusted to your need.

Code: Select all

setlocale(LC_ALL, 'de_AT');
if (time()>strtotime("Last Sunday April 1")) { 
  if (time()>strtotime("Last Sunday November 1")) {
    echo utf8_encode(strftime("%d. %B %Y",strtotime("Last Sunday April 1 ".date("Y",strtotime("Next Year")))));
  } else {
    echo utf8_encode(strftime("%d. %B %Y",strtotime("Last Sunday November 1")));  
  }
} else {
  echo utf8_encode(strftime("%d. %B %Y",strtotime("Last Sunday April 1")));
}
To see it in action: http://www.elektrotechnik-schmidt.at/fi-schutzschalter/