function BSTCheck() {
$ThisYear = (date("Y"));
$MarStartDate = ($ThisYear."-03-25");
$OctStartDate = ($ThisYear."-10-25");
$MarEndDate = ($ThisYear."-03-31");
$OctEndDate = ($ThisYear."-10-31");
//work out the Unix timestamp for 1:00am GMT on the last Sunday of March, when BST starts
while ($MarStartDate <= $MarEndDate) {
$day = date("l", strtotime($MarStartDate));
if ($day == "Sunday")
$BSTStartDate = ($MarStartDate);
$MarStartDate++;
}
$BSTStartDate = (date("U", strtotime($BSTStartDate))+(60*60));
//work out the Unix timestamp for 1:00am GMT on the last Sunday of October, when BST ends
while ($OctStartDate <= $OctEndDate) {
$day = date("l", strtotime($OctStartDate));
if ($day == "Sunday")
$BSTEndDate = ($OctStartDate);
$OctStartDate++;
}
$BSTEndDate = (date("U", strtotime($BSTEndDate))+(60*60));
//Check to see if we are now in BST
$now = mktime();
return (($now >= $BSTStartDate) && ($now <= $BSTEndDate)) ? TRUE : FALSE;
}
$DST = (BSTCheck()) ? 3600 : 0;
$time = gmdate("H:i", time() + $DST);
$night = ((date("H")>=17) OR (date("H")<5)) ? TRUE : FALSE;
Recent Comments