Date Time Php

and standard time. Returns 1 if given time is in daylight savings 0 otherwise
# IS_DAYLIGHT_TIME: Returns 1 (true) if given $time is in daylight savings
# time; 0 (false) otherwise.
#
# Parameters:
# (int)$time This is the desired time, in Unix seconds-since-the-epoch
# format.
#
# Notes:
# Daylight time is defined as starting at 2am on the first Sunday in April
# (2am becomes 3am), and ending at 2am on the last Sunday in October (2am
# becomes 1am).
#
function is_daylight_time($time) {
list($dom, $dow, $month, $hour, $min) = explode( ":", date( "d:w:m:H:i", $time));
if ($month > 4 && $month < 10) {
$retval = 1; # May thru September
} elseif ($month == 4 && $dom > 7) {
$retval = 1; # After first week in April
} elseif ($month == 4 && $dom <= 7 && $dow == 0 && $hour >= 2) {
$retval = 1; # After 2am on first Sunday ($dow=0) in April
} elseif ($month == 4 && $dom <= 7 && $dow != 0 && ($dom-$dow > 0)) {
$retval = 1; # After Sunday of first week in April
} elseif ($month == 10 && $dom < 25) {
$retval = 1; # Before last week of October
} elseif ($month == 10 && $dom >= 25 && $dow == 0 && $hour < 2) {
$retval = 1; # Before 2am on last Sunday in October
} elseif ($month == 10 && $dom >= 25 && $dow != 0 && ($dom-24-$dow < 1) ) {
$retval = 1; # Before Sunday of last week in October
} else {
$retval = 0;
}
return($retval);
?>