In my application I have varchar field in mysql for 365 days in particular format i.e. '0000-04-12' (12th of April). Right now I am having a function that should check if particular date from field falls in daylight saving zone of Calgary-Canada, which ranges from 2:00 pm Second Sunday of March to 2:00 pm First Sunday of November. and returns true or false accordingly.
<?php
/*
@param $time form Database e.g. 0000-04-12
*/
function isDaylightSaving($time){
// to replace 0000 in start with current year
$today = substr_replace($time,date('Y'),0,4);
$date = new DateTime($today);
$week = $date->format('W');
// TO DO
// find date falls between 2:00 pm Second Sunday of March to 2:00 pm First Sunday of November.
return ;
}
?>
Right now its returning the week with respect to particular year but I need to check week with respect to month to perform particular logic, which I am unable to get.Thanks.