PHP 获取两个日期之间的日期数组/月份数组
function getEmptyArr($s_time,$e_time,$type){
$tmp = array();
if($type=='day'){
$s_time = strtotime($s_time);
$e_time = strtotime($e_time);
while($e_time>=$s_time){
$tmp[] = date('Y-m-d',$e_time);
$e_time -= 86400;
}
}else if('month'){
$s_time = strtotime(date('Y-m',strtotime($s_time)));
$e_time = strtotime(date('Y-m',strtotime($e_time)));
while($e_time>=$s_time){
$e_time_str = date('Y-m',$e_time);
$tmp[] = $e_time_str;
$e_time = strtotime("$e_time_str -1 month");
}
}
return $tmp;
}
PHP 获取两个日期之间的日期数组/月份数组的更多相关文章
- Java 获取两个日期之间的日期
1.前期需求,两个日期,我们叫他startDate和endDate,然后获取到两个日期之间的日期 /** * 获取两个日期之间的日期 * @param start 开始日期 * @param end ...
- SHELL打印两个日期之间的日期
SHELL打印两个日期之间的日期 [root@umout shell]# cat date_to_date.sh THIS_PATH=$(cd `dirname $0`;) cd $THIS_PATH ...
- PHP 获取两个时间之间的月份
## 获取两个时间之间的间距时间 $s = '2017-02-05'; $e = '2017-07-20'; $start = new \DateTime($s); $end = new \DateT ...
- C# 获取两个时间段之间的所有时间与获取当前时间所在的季度开始和结束时间
一:C# 获取两个时间段之间的所有时间 public List<string> GetTimeList(string rq1, string rq2) { List<string&g ...
- sql返回两个日期之间的日期_函数实现
-- Description:返回两段日期之间的所有日期 <Description,,>-- ============================================ ...
- PHP 日期之间所有日期
/** * 获取起止日期之间所有日期 * @param $sdate * @param $edate * @return array */ function get_dates($sdate, $ed ...
- js实现获取两个日期之间所有日期最简单的方法
Date.prototype.format = function() { var s = ''; var mouth = (this.getMonth() + 1)>=10?(this.getM ...
- vue js实现获取两个日期之间所有日期
https://blog.csdn.net/m0_37852904/article/details/85790793 // 计算续住的总日期列表 getAll(begin, end) { let ar ...
- js实现获取两个日期之间所有日期的方法
function getDate(datestr){ var temp = datestr.split("-"); var date = new Date(temp[0],temp ...
随机推荐
- Servlet 之 HttpServlet
package cn.jiemoxiaodi.http; import java.io.IOException; import javax.servlet.GenericServlet; import ...
- centos6.3安装python2.7, pip2.7, mysql
参考: https://github.com/h2oai/h2o-2/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-ex ...
- JavaScript高级程序设计学习笔记--表单脚本
提交表单 用户单击提交按钮或图像按钮时,就会提交表单.使用<input>和<button>都可以定义提交按钮,只要将其type特性的值设置为"submit" ...
- October 19th Week 43rd Wednesday, 2016
I find that the harder I work, the more luck I seem to have. 越努力,越幸运. However, I find that the harde ...
- byte数组和File,InputStream互转
1.将File.FileInputStream 转换为byte数组: File file = new File("file.txt"); InputStream input = n ...
- static lib和dynamic lib
lib分为 staticlib 和 dynamic lib: 静态lib将导出声明和实现都放在lib中,编译后所有代码都嵌入到宿主程序, 链接器从静态链接库LIB获取所有被引用函数,并将库同代码一起放 ...
- 已解决:ECSHOP安装出现date_default_timezone_get()问题
今天在安装ECSHOP时遇到警告如下: Warning: date_default_timezone_get(): It is not safe to rely on the system's tim ...
- Guava学习笔记(3):复写的Object常用方法
转自:http://www.cnblogs.com/peida/p/Guava_Objects.html 在Java中Object类是所有类的父类,其中有几个需要override的方法比如equals ...
- Redis学习笔记(3) Redis基础类型及命令之二
1. 集合类型 集合类型与列表类型有很多相似之处,但二者的区别在于:前者具有唯一性,但不具有有序性:后者具有有序性,但不具有唯一性.集合类型的常用操作是向集合中加入或删除元素.判断某个元素是否存在等, ...
- 2015年ACM沈阳网络赛(准备做掉4道:)
Traversal Best Solver Minimum Cut Dividing This Product Excited Database Fang Fang Matches Puzzle Ga ...