PHP:本週開始與結束日期

<?php
$getDate = date('Y-m-d');
$first_day = 0;//每週的第一天從星期日開始
$weekday = date("w", strtotime($getDate));
$del_day = $weekday - $first_day;
$week_start_day  = date("Y-m-d", strtotime("$getdate -".$del_day." days"));
$week_end_day   = date("Y-m-d", strtotime("$week_start_day +6 days"));
?>
本篇發表於 PHP。將永久鏈結加入書籤。

回應已關閉。