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元.优步还加大了乘客端折扣力度,最低五折坐车!单子超多,上线就有单,接单接不停!欢迎各位 ...
随机推荐
- Markdown各种小问题汇总
如何分割Quote? How can I write two separate blockquotes in sequence using markdown? > Imagination is ...
- Wide character in print at a2.pl line 返回json 需要encode_utf8
centos6.5:/root/test#cat a2.pl use Net::SMTP; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Heade ...
- 汉企C#面向对象——继承Practice
class Dianqi //创建电器类:父类 { private string _Dianqimingzi; public string Dianqimingzi { get { return _D ...
- SPOJ_10628_Count_on_a_Tree_(主席树+Tarjan)
描述 http://www.spoj.com/problems/COT/ 给出一棵n个节点的树,树上每一个节点有权值.m次询问,求书上u,v路径中第k小的权值. COT - Count on a tr ...
- Java邮件开发(JavaMail)
Sun发布的用来处理email的API,它可以方便地执行一些常用的邮件传输.JavaMail API是Sun公司为方便Java开发人员在应用程序中实现邮件发送和接收功能而提供的一套标准开发包,它支持一 ...
- sql server 2005+ 翻页
select * from ( select row_number() over (order by dm) row,* from t_zycp where dm like '%4%' ) tmp
- 【转】关于Certificate、Provisioning Profile、App ID的介绍及其之间的关系
原文网址:http://www.cnblogs.com/cywin888/p/3263027.html 刚接触iOS开发的人难免会对苹果的各种证书.配置文件等不甚了解,可能你按照网上的教程一步一步的成 ...
- android开发板
element14-beaglebone-black http://www.embest-tech.cn/shop/star/element14-beaglebone-black-rev-c.html ...
- tomcat web容器中,调用jersey client端报错的处理
在web工程中,写main方法,运行ok. 发布到tomcat中后,报错. javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/r ...
- 《神经网络和深度学习》系列文章三:sigmoid神经元
出处: Michael Nielsen的<Neural Network and Deep Leraning>,点击末尾“阅读原文”即可查看英文原文. 本节译者:哈工大SCIR硕士生 徐伟 ...