function get_week_number_by_date($date) {
$today = $date;
$currentDay = date("w", strtotime($date));
$todate = date('Y-m-d', strtotime($date));
$myTime = $todate." 18:00:00";
$weekNumber = date("W", strtotime("0 day", strtotime($date)));
if($currentDay == 0){
if(strtotime($today) > strtotime($myTime)){
$weekNumber = date("W", strtotime("1 day", strtotime($date)));
}
}
return $weekNumber;
}
In this example I have setup "sunday 6:00 PM" as a week start day.
No comments:
Post a Comment