PHP Current Week Number

TAGs: 1 Comment

Posted By: eligeske on in PHP

I did not fully test this for every scenario and leap years. But it worked for what I was using it for. If anyone has any bugs with it, let me know.

function currWeek()
$dateArray = getdate();
$yday = $dateArray['yday'];
$wday = $dateArray['wday'];
$cMon = $yday – $wday;
$currWk = ceil($cMon/7);
return $currWk;

One Response to "PHP Current Week Number"

  1. date(‘W’);
    First day of the week is Monday.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Learning DHTMLX Suite UI

Learn the foundation of the DHTMLX Suite quickly while building a single page application with multiple components in harmony.

Popular post