PHP 日期之间所有日期

 

/**
 * 获取起止日期之间所有日期
 * @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为星期日

 

posted on 2019-08-20 14:20  你看我哪里像好人  阅读(427)  评论(0编辑  收藏  举报

导航