$thismonth = date('m');
$thisyear = date('Y');
if ($thismonth == 1) {
$lastmonth = 12;
$lastyear = $thisyear - 1;
} else {
$lastmonth = $thismonth - 1;
$lastyear = $thisyear;
}
$lastStartDay = $lastyear . '-' . $lastmonth . '-1';
$lastEndDay = $lastyear . '-' . $lastmonth . '-' . date('t', strtotime($lastStartDay));
$b_time = strtotime($lastStartDay);//上个月的月初时间戳
$e_time = strtotime($lastEndDay);//上个月的月末时间戳
return $b_time.$e_time;

php取上个月月初和月末时间戳的更多相关文章

  1. php获取当前月与上个月月初及月末时间戳的方法

    php 获取今日.昨日.上周.本月的起始时间戳和结束时间戳的方法,主要使用到了 php 的时间函数 mktime.下面首先还是直奔主题以示例说明如何使用 mktime 获取今日.昨日.上周.本月的起始 ...

  2. php获取当前月月初至月末的时间戳,上个月月初至月末的时间戳

    当前月 <?php $thismonth = date('m'); $thisyear = date('Y'); $startDay = $thisyear . '-' . $thismonth ...

  3. 015.Oracle数据库,取本月月初,取本月月末

    /*取本月月初,取本月月末*/ SELECT trunc( SYSDATE, 'mm' ) AS 月初 , last_day(trunc(sysdate)) AS 月末 FROM dual; 修改如下 ...

  4. php获取指定月份月初和月末的时间戳

    获取指定月份的开始时间戳和结束时间戳,只需传入年月即可(2018-01,2018-1两种格式都可以) $data['sel_time'] = '2018-11'; $data['begin_time' ...

  5. php 获取上个月的起止时间戳

    $thismonth = date('m'); $thisyear = date('Y'); if ($thismonth == 1) { $lastmonth = 12; $lastyear = $ ...

  6. JavaScript日期集合(今日,昨日,本周一,周末 ,月初,月末)

    闲聊:新年第一天上班,看着自己15年年底写的代码,真心觉得很烂,因为年底没时间去写,一想着做后台管理需要获取一周的开始和结束日期,就慌了,项目赶着测试呢,还有好多事情未做,就直接抄袭了网上的一段错误代 ...

  7. Java用于取得当前日期相对应的月初,月末,季初,季末,年初,年末时间

    package com.zrar.date; import java.util.Calendar; /** * * 描述:此类用于取得当前日期相对应的月初,月末,季初,季末,年初,年末,返回值均为St ...

  8. c# 根据当前时间获取,本周,本月,本季度,月初,月末,各个时间段(转但是都是使用过)

    DateTime dt = DateTime.Now;  //当前时间 DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") 24小时制 Dat ...

  9. sql 月初和月末

    --月初 select  convert(varchar(10),dateadd(day,-(day(getdate()) -1),getdate()) ,120) --月末select  conve ...

随机推荐

  1. 007_Python3 字符串

    字符串是 Python 中最常用的数据类型.我们可以使用引号( ' 或 " )来创建字符串. 创建字符串很简单,只要为变量分配一个值即可. 例如: var1 = 'Hello World!' ...

  2. SQL Server全文检索

    SQL Server 全文索引的硬伤 http://www.cnblogs.com/gaizai/archive/2010/05/13/1733857.html SQLSERVER全文搜索 http: ...

  3. 安利一个IDA插件diaphora,可以将函数名、注释、结构体等的先前版本移植到新版本

    插件代码地址 https://github.com/joxeankoret/diaphora 使用方法: 启动IDA并首先打开包含完整符号的二进制文件1.让我们的IDA完成初始的自动分析,之后,通过运 ...

  4. Linux分区格式化

    格式化(format)是指对磁盘或磁盘中的分区(partition)进行初始化的一种操作,这种操作通常会导致现有的磁盘或分区中所有的文件被清除.格式化通常分为低级格式化和高级格式化.如果没有特别指明, ...

  5. leetcode解题报告(15):Third Maximum Number

    描述 Given a non-empty array of integers, return the third maximum number in this array. If it does no ...

  6. linux系列(六):rmdir命令

    1.命令格式: rmdir [选项] 目录名 2.命令功能: 该命令从一个目录中删除一个或多个子目录项,删除某目录时也必须具有对父目录的写权限. 3.命令参数: - p 删除指定目录后,若该目录的上层 ...

  7. P1025 数的划分——简单题刷傻系列

    P1025 数的划分 学傻了,学傻了,什么dp搜索什么啊: #include<cstdio> #include<cstring> #include<algorithm&g ...

  8. Codeforces - 2019年11月补题汇总

    大概目标是补到 #500 为止的 Div. 2 ,先定个小目标,寒假开始前补到 #560 为止 Codeforces Round #599 (Div. 2) 5/6 备注:0-1BFS(补图连通块) ...

  9. sqlserver 两 表 数据 复制 (附加 跨服务器 查询的方法)

    一 : 这个sql 语句 可以快速的 将 一 个旧表 中的指定字段的数据 复制到 另一个新表的指定字段中 insert into dbo.Customer ( CustomerId , Custome ...

  10. java大型互联网项目大流量高并发所需的技术

    互联网一般运行技术:webservice,jquery,访问量,缓存,数据安全等,JAVA后台就比较多了,不过,像这种大型的互联网项目,基本框架都有了,你需要做的就是熟悉业务,熟悉他们公司所用的框架, ...