612
622
$year = date('Y', $timestamp);
614
624
// Information on Daylight Saving time was obtained from http://webexhibits.org/daylightsaving/g.html
625
// Note that 'last sunday' is interpreted as 'the last sunday before...'.
615
626
switch ($region) {
619
630
// start of DST (last Friday in April)
620
$dststart = strtotime("-1 week friday UTC", strtotime("1 may $year UTC"));
631
$dststart = strtotime("last friday UTC", strtotime("1 may $year UTC"));
621
632
// end of DST (last Thursday in September)
622
$dstend = strtotime("-1 week thursday UTC", strtotime("1 october $year UTC"));
633
$dstend = strtotime("last thursday UTC", strtotime("1 october $year UTC"));
624
635
case 2: // Namibia
625
636
// start of DST (first Sunday in September)
626
$dststart = strtotime("1 week sunday UTC", strtotime("1 september $year UTC"));
637
$dststart = strtotime("first sunday UTC", strtotime("1 september $year UTC"));
627
638
// end of DST (first Sunday April)
628
$dstend = strtotime("1 week sunday UTC", strtotime("1 april $year UTC"));
639
$dstend = strtotime("first sunday UTC", strtotime("1 april $year UTC"));
630
641
case 3: // Former USSR
631
642
// start of DST (last Sunday in March)
632
$dststart = strtotime("-1 week sunday UTC", strtotime("1 april $year UTC"));
643
$dststart = strtotime("last sunday UTC", strtotime("1 april $year UTC"));
633
644
// end of DST (last Sunday October)
634
$dstend = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
645
$dstend = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
636
647
case 4: // Iraq, Syria
637
648
// start of DST (April 1st)
699
710
case 9: // South Australia
700
711
// start of DST (last Sunday in October)
701
$dststart = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
712
$dststart = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
702
713
// end of DST (last Sunday in March)
703
$dstend = strtotime("-1 week sunday UTC", strtotime("1 april $year UTC"));
714
$dstend = strtotime("last sunday UTC", strtotime("1 april $year UTC"));
705
716
case 10: // Australia, Tasmania
706
717
// start of DST (first Sunday in October)
707
$dststart = strtotime("1 week sunday UTC", strtotime("1 october $year UTC"));
718
$dststart = strtotime("first sunday UTC", strtotime("1 october $year UTC"));
708
719
// end of DST (last Sunday in March)
709
$dstend = strtotime("-1 week sunday UTC", strtotime("1 april $year UTC"));
720
$dstend = strtotime("last sunday UTC", strtotime("1 april $year UTC"));
711
722
case 11: // New Zealand
712
723
// start of DST (first Sunday in October)
713
$dststart = strtotime("1 week sunday UTC", strtotime("1 october $year UTC"));
714
// end of DST (third Sunday in March)
715
$dstend = strtotime("3 week sunday UTC", strtotime("1 march $year UTC"));
724
$dststart = strtotime("first sunday UTC", strtotime("1 october $year UTC"));
725
// end of DST (first Sunday in April)
726
$dstend = strtotime("first sunday UTC", strtotime("1 april $year UTC"));
717
728
case 12: // Tonga
718
729
// start of DST (first Sunday in November)
719
$dststart = strtotime("1 week sunday UTC", strtotime("1 november $year UTC"));
730
$dststart = strtotime("first sunday UTC", strtotime("1 november $year UTC"));
720
731
// end of DST (last Sunday in January)
721
$dstend = strtotime("-1 week sunday UTC", strtotime("1 february $year UTC"));
732
$dstend = strtotime("last sunday UTC", strtotime("1 february $year UTC"));
723
734
case 13: // EU and other European countries
724
735
// start of DST (last Sunday in March 1 am UTC)
725
$dststart = strtotime("-1 week sunday UTC", strtotime("1 april $year UTC"));
736
$dststart = strtotime("last sunday UTC", strtotime("1 april $year UTC"));
726
737
// end of DST in Europe (last Sunday in October 1 am UTC)
727
$dstend = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
738
$dstend = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
729
740
case 14: // Russian Federation
730
741
// start of DST (last Sunday in March 2 am local time)
731
$dststart = strtotime("-1 week sunday UTC", strtotime("1 april $year UTC"));
742
$dststart = strtotime("last sunday UTC", strtotime("1 april $year UTC"));
732
743
// end of DST (last Sunday in October 2 am local time)
733
$dstend = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
744
$dstend = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
735
746
case 15: // Northern America (where applicable)
736
747
// start of DST (where applicable) (first Sunday in April before 2007,
737
748
// after that second Sunday in March, 2 am local time)
738
749
if ($year < 2007) {
739
$dststart = strtotime("1 week sunday UTC", strtotime("1 april $year UTC"));
750
$dststart = strtotime("first sunday UTC", strtotime("1 april $year UTC"));
742
$dststart = strtotime("1 week sunday UTC", strtotime("1 march $year UTC"));
753
$dststart = strtotime("second sunday UTC", strtotime("1 march $year UTC"));
744
755
// end of DST (where applicable) (last Sunday in October 2 am local time)
745
756
if ($year < 2007) {
746
$dstend = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
757
$dstend = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
749
$dstend = strtotime("1 week sunday UTC", strtotime("1 november $year UTC"));
760
$dstend = strtotime("first sunday UTC", strtotime("1 november $year UTC"));
753
764
// start of DST (April 1st)
754
765
$dststart = strtotime("1 april $year UTC");
755
766
// end of DST (last Sunday in October)
756
$dstend = strtotime("-1 week sunday UTC", strtotime("1 november $year UTC"));
767
$dstend = strtotime("last sunday UTC", strtotime("1 november $year UTC"));
758
769
case 17: // Brazil
759
770
// start of DST (first Sunday in November)
760
$dststart = strtotime("1 week sunday UTC", strtotime("1 november $year UTC"));
771
$dststart = strtotime("first sunday UTC", strtotime("1 november $year UTC"));
761
772
// end of DST (third Sunday in February)
762
$dstend = strtotime("3 week sunday UTC", strtotime("1 february $year UTC"));
773
$dstend = strtotime("third sunday UTC", strtotime("1 february $year UTC"));
764
775
case 18: // Chile
765
776
// start of DST (Second Saturday of October - at midnight)
766
$dststart = strtotime("2 week saturday UTC", strtotime("1 october $year UTC"));
777
$dststart = strtotime("second saturday UTC", strtotime("1 october $year UTC"));
767
778
// end of DST (Second Saturday of March - at midnight)
768
$dstend = strtotime("2 week sunday UTC", strtotime("1 march $year UTC"));
779
$dstend = strtotime("second sunday UTC", strtotime("1 march $year UTC"));
770
781
case 19: // Falklands
771
782
// start of DST (First Sunday on or after 8 September)