本文整理汇总了PHP中date::week方法的典型用法代码示例。如果您正苦于以下问题:PHP date::week方法的具体用法?PHP date::week怎么用?PHP date::week使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类date
的用法示例。
在下文中一共展示了date::week方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: week_days
public function week_days($year = FALSE, $week = FALSE)
{
$w = date::week($year, $week);
$list = array();
for ($day = 0; $day <= 6; $day++) {
$list[] = date('Y-m-d', strtotime($w['year'] . "W" . $w['week'] . $day));
}
return $list;
}
示例2: last_day_of_week
public static function last_day_of_week($year = null, $month = null, $week = null, $format = 'j')
{
if ($year === null) {
$year = date::year();
}
if ($month === null) {
$month = date::month();
}
if ($week === null) {
$week = date::week();
}
if ($week == date::weeks_in_month($year, $month)) {
return date::last_day_of_month($year, $month, $format);
}
if ($week > date::weeks_in_month($year, $month)) {
return 0;
}
return date($format, strtotime('this sunday', date::first_day_of_week($year, $month, $week, 'U')));
}