phpstrtotime()对于31日求上个月有问题
PHP自带的strtotime()对于31日求上个月有问题,如下:
<?php
$date = "2012-07-31";
$date_unix = strtotime($date);
$lastmonth = strtotime("last month",$date_unix);//或者strtotime("-1 month",$date_unix);
echo date("Y-m-d H:i:s",$lastmonth)."<br />";//输出:2012-07-01 00:00:00
$last_month_end = strtotime(date("Ym"."01000000",$date_unix)) - 1;//上个月的最后一秒
echo date("Y-m-d H:i:s",$last_month_end);//输出:2012-06-30 23:59:59
?>
phpstrtotime()对于31日求上个月有问题的更多相关文章
- PHP中的strtotime()对于31日求上个月有问题
原文出处 <?php $date = "2012-07-31"; $date_unix = strtotime($date); $lastmonth = strtotime( ...
- java中求一下2008年5月31日, 往前倒30天是哪天?
题目9: 2008年5月31日, 往前倒30天是哪天? import java.util.*; public class Test { public static void main(Str ...
- 2016年12月31日 星期六 --出埃及记 Exodus 21:26
2016年12月31日 星期六 --出埃及记 Exodus 21:26 "If a man hits a manservant or maidservant in the eye and d ...
- 2016年10月31日 星期一 --出埃及记 Exodus 19:16
2016年10月31日 星期一 --出埃及记 Exodus 19:16 On the morning of the third day there was thunder and lightning, ...
- MyOD课堂实践(5月31日)20155318
MyOD课堂实践(5月31日)20155318 编写MyOD.java 用java MyOD XXX实现Linux下od -tx -tc XXX的功能 (码云链接) 代码 import java.io ...
- 北京Uber优步司机奖励政策(3月31日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 北京Uber优步司机奖励政策(12月31日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 成都Uber优步司机奖励政策(3月31日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 成都Uber优步司机奖励政策(8月31日~9月6日)
本周(8月31日-9月6日),优步成都继续推出丰厚保底奖励,日保底总金额最高575元,每周保底最高可获得3595元.优步还加大了乘客端折扣力度,最低五折坐车!单子超多,上线就有单,接单接不停!欢迎各位 ...
随机推荐
- BZOJ1510: [POI2006]Kra-The Disks
1510: [POI2006]Kra-The Disks Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 265 Solved: 157[Submit][ ...
- 【转】Android自定义控件
原文网址:http://blog.163.com/ppy2790@126/blog/static/103242241201382210910473/ 开发自定义控件的步骤: 1.了解View的工作原理 ...
- (转载)Flash Builder和flashdevelop 常用快捷键
(转载)http://www.fantxi.com/blog/archives/fb-fd-shortcut/ =========flashdevelopCtrl+B - snippetsctrl+s ...
- (转载)PHP 判断常量,变量和函数是否存在
(转载)http://www.jb51.net/article/17881.htm 如果你看懂了上面一句话,那么接下来都是废话,PHP手册写的还是很全的.一句话就把我标题中的问题全部解决了. 还是举几 ...
- EF中执行存储过程,获取output返回值
EF不能直接支持执行存储过程,于是使用转化成执行SQL语句的形式,却怎么也获取不到output的值,折腾的好久,终于解决了,分享下曲折的经历: public int AddVote(int title ...
- Tyvj P1463 智商问题 分块
P1463 智商问题 时间: 1500ms / 空间: 131072KiB / Java类名: Main 背景 各种数据结构帝~各种小姊妹帝~各种一遍AC帝~ 来吧! 描述 某个同学又有很多小姊妹了他 ...
- parseSdkContent failed Could not initialize class android.graphics.Typeface
Deleting ".android" is temporarily fixing the problem with me as after sometime it begins ...
- HW4.19
public class Solution { public static void main(String[] args) { for(int i = 1; i <= 8; i++) { fo ...
- 最短路SPFA
用邻接矩阵a表示一幅图,a[i][j]表示从点i到点j的边长,如果为0则无边.(这是无负边,0边的情况) 这张图有T个点,C条边,要求求出从Ts走到Te的最短路. 用f[i]表示从Ts走到i点的最短路 ...
- Java--创建线程及常用方法
继承java.lang.Thread类--Thread类代表线程类 它的常用方法如下: static Thread currentThread():返回当前正在运行的线程对象的引用. static ...