Next Daylight Saving Change Date

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
GSM
Forum Members
Forum Members
Posts: 19
Joined: Wed Aug 08, 2007 2:38 pm

Next Daylight Saving Change Date

Post 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/
Post Reply

Return to “Tips and Tricks”