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 ...
随机推荐
- 使用jvisualvm.exe 的Btrace插件介绍/使用教程
一.背景 在生产环境中可能经常遇到各种问题,定位问题需要获取程序运行时的数据信息,如方法参数.返回值.全局变量.堆栈信息等.为了获取这些数据信息,我们可以 通过改写代码,增加日志信息的打 ...
- Httpsqs队列基本操作
一,安装 ulimit -SHn 65535 wget http://httpsqs.googlecode.com/files/libevent-2.0.12-stable.tar.gz tar zx ...
- Spring 定时器Quartz的用法
Spring定时器Quartz的用法也很简单,需要引入quartz-all-1.5.2.jar java代码如下: package com.coalmine.desktop; import java. ...
- Gym - 101102B
题目链接 用火柴棍拼出最大的数,思维题,最后发现暴力1e7刚刚不会超时. #include <bits/stdc++.h> using namespace std; ]={,,,,,,,, ...
- linux apt-get install 错误: Package has no installation candidate
sudo apt-get install vim 在安装vim时报如下错误: Error accoured: This may mean that the package is missing, ha ...
- WEB容器启动——web.xml加载详解
最近在看spring的源码,关于web.xml文件在容器(Tomcat.JBOSS等)启动时加载顺序问题很混乱,通过搜集资料,得出以下的结论: 1.加载顺序与它们在 web.xml 文件中的先后顺序无 ...
- 11 JSP/EL表达式/EL函数
JSP * 概述: JSP(Java Server Pages)与Java Servlet一样,是在服务器端执行的不同的是先由服务器编译部署成Servlet执行 * JSP的运行原 ...
- java抽象类实践
package javaClassStudy; /** * * @author yuxg * 抽象类实践 */ public abstract class Person { private Strin ...
- bzoj 3791: 作业
Description 众所周知,白神是具有神奇的能力的. 比如说,他对数学作业说一声“数”,数学作业就会出于畏惧而自己完成:对语文作业说一声“语”,语文作业就会出于畏惧而自己完成. 今天,语文老师和 ...
- Leetcode Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...