Skip to content

Instantly share code, notes, and snippets.

@shigwata
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save shigwata/c908a9af3ea956aa3c8d to your computer and use it in GitHub Desktop.

Select an option

Save shigwata/c908a9af3ea956aa3c8d to your computer and use it in GitHub Desktop.
月の何週目か取得
<?php
/**
* 月の何週目か取得
* @param integer $y 年
* @param integer $m 月
* @param integer $d 日
*/
function getNthWeek($y, $m, $d)
{
$week1 = date('W', mktime(0, 0, 0, $m, 1, $y));
$week2 = date('W', mktime(0, 0, 0, $m, $d, $y));
$week_num = $week2 - $week1 + 1;
return $week_num;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment