Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Roman Glebushkin
Added: Apr 12, 2018 7:58 PM
Views: 32
Tags: date php week
  1. function getLastWeekNumber($month = 'December', $year) {
  2.     $timestamp =  strtotime("last day of {$month} {$year}");
  3.     $m = date('m', $timestamp);
  4.     $lastWeekOfNum = date("W", $timestamp);
  5.     return ($m == 12 && $lastWeekOfNum == 1) ? 53 : $lastWeekOfNum;
  6. }