PHP 日期之间所有日期

2019/08/20 14:20
阅读数 77

 

/**
 * 获取起止日期之间所有日期
 * @param $sdate
 * @param $edate
 * @return array
 */
function get_dates($sdate, $edate)
{
  $_arr_date = array();

  $time_start = strtotime($sdate);
  $time_end = strtotime($edate);
  while ($time_start <= $time_end) {
    $_arr_date[] = date('Y-m-d', $time_start);
    $time_start = strtotime('+1 day', $time_start);
  }

  return $_arr_date;
}


echo '<br>', date("l", strtotime('2019-02-21')); //英文星期 Thursday
echo '<br>', date("w", strtotime('2019-02-21')); //数字星期 0123456,其中0为星期日

 

展开阅读全文
php
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部