设为首页 加入收藏

TOP

PHP 日期之间所有日期
2019-09-03 02:46:57 】 浏览:42
Tags: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为星期日

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇PHP设置谷歌验证器(Google Authe.. 下一篇php图片防盗链

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目