一日,遇到一个问题,求上一个月的今天。 最开始我们使用strtotime(“-1 month”)函数求值,发现有一个问题,月长度不一样的月份的计算结果有误。 比如:2011-03-31,得到的结果是2011-03-03。我们先不追究什么问题,先看如何解决问题。 此时,想起PHP中有一个mktime函...
分类:
Web程序 时间:
2014-12-31 12:42:26
阅读次数:
185
$a = '2014-12-30 00:00:00';$b = '2014-12-30 00:10:00';echo strtotime($a)."\n"; //1419894000echo strtotime($b); //1419894600相差10分钟(600秒),时间戳...
分类:
其他好文 时间:
2014-12-30 11:16:42
阅读次数:
143
//解决比如3月31号加一个月变成5月1号等问题
$time?=?time();
//当前月份中的第几天
$day?=?date(‘j‘,$time);
//这个月的天数
$month_day?=?date(‘t‘,$time);
//这个月的第一天
$first_day_of_month_time?...
分类:
其他好文 时间:
2014-12-24 16:29:12
阅读次数:
171
//PHP 日期 加减 天 date("Y-m-d",strtotime("2013-11-12 12:12:12 +1 day")) ;//PHP 日期 加减 天 date("Y-m-d",strtotime("2013-11-12 12:12:12 +1 month")) ;//PHP 日期.....
分类:
Web程序 时间:
2014-12-15 15:14:14
阅读次数:
166
1.当前时间,往后退5天:date('Y-m-d H:i:s',strtotime('-1 days'));2.有固定时间,往后面退一天或者七天,或者30天:比如时间:$time =2014-12-05 14:48:59往后推一天:$time_sp=strtotime($time); //转化为时间...
分类:
Web程序 时间:
2014-12-06 15:16:23
阅读次数:
156
实现方法function isDate( $dateString ) { return strtotime( date('Y-m-d', strtotime($dateString)) ) === strtotime( $dateString );} echo $this->isDate...
分类:
Web程序 时间:
2014-12-03 10:28:42
阅读次数:
271
今天:'; echo date("Y-m-d",strtotime("now")), "\n"; echo date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d"),date("Y")));echo '昨天:'; echo da...
分类:
Web程序 时间:
2014-12-01 10:01:25
阅读次数:
229
一般浏览器请求php是不会被缓存的,除非php直接显示的发送head 304if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $browserCachedCopyTimestamp = strtotime(preg_replace('/;.*$/',.....
分类:
Web程序 时间:
2014-11-25 18:10:02
阅读次数:
357
function?T($time)
{
???//获取今天凌晨的时间戳
???$day?=?strtotime(date(‘Y-m-d‘,time()));
???//获取昨天凌晨的时间戳
???$pday?=?strtotime(date(‘Y-m-d‘,strtotime(‘-1?day‘)));
???/...
分类:
Web程序 时间:
2014-11-22 12:10:05
阅读次数:
218
完整php类,通常我会配合smary使用,快捷使用 (plugins/function.rdate.php),更多php技术开发就去php教程网,http://php.662p.com200601*/){ return date('Ym',strtotime('+1 month',strtot...
分类:
Web程序 时间:
2014-11-17 10:31:52
阅读次数:
237