字符串转成date$str =date("Y-m-d H:i:s",strtotime("2011-12-12 14:23:01")); echo $str;date规则之间的转换,例如"2011-12-12 14:23:01 转换为"2011-12-12$d = strtotime(date('Y...
分类:
Web程序 时间:
2015-04-03 16:56:28
阅读次数:
177
strtotime不仅可以使用类似Y-m-d此类标准的时间/日期字符串来转化时间戳, 还可以用类似自然语言的来生成时间戳, 类似: strtotime('last day'); strtotime('first day'); strtotime('+1 da...
分类:
其他好文 时间:
2015-04-01 17:07:55
阅读次数:
113
原文:php中时间戳和日期格式的转换 一,PHP时间戳函数获取指定日期的unix时间戳 strtotime(”2009-1-22″) 示例如下: echo strtotime(”2009-1-22″) 结果:1232553600 说明:返回2009年1月22日0点0分0秒时间戳 二,PHP时间戳函数...
分类:
Web程序 时间:
2015-03-18 13:40:20
阅读次数:
140
根据年份和第几周获取该周开始的时间戳的正确方法strtotime('2012-W50');附加:获取该周第N天的时间戳:strtotime('2012-W50-2');**************格式中可使用字母的含义**************/a – "am" 或是 "pm"A – "AM" 或...
分类:
Web程序 时间:
2015-03-05 19:24:02
阅读次数:
146
1 "; 6 7 echo "今天:",date("Y-m-d",strtotime("18 june 2008")),""; 8 9 echo "昨天:",date("Y-m-d",strtotime("-1 day")), "";10 11 echo "明天:",date("Y-m-d",...
分类:
Web程序 时间:
2015-02-17 14:04:42
阅读次数:
307
最近项目中有个需求, 要记录新注册用户的次日登录情况,于是写出了如下代码:$create_time = '用户注册时间'; //格式 Y-m-d H:i:s$time = time(); $lasttime = date('Y-m-d H:i:s', $time); ...
分类:
Web程序 时间:
2015-02-06 20:17:53
阅读次数:
173
mongodb 中数据记录的日期格式为"dateCreated" :ISODate("2011-12-20T07:22:50.836Z")经过翻阅php官网中的mongodb部分得知,要操作mongodb中的日期须要使用以下关键语句:$start = new MongoDate(strtotime(...
分类:
数据库 时间:
2015-02-03 22:33:38
阅读次数:
802
今天客户反映有个功能投票模块第一天投了后,第二天就不能投了,理论上是第二天凌晨就可以再答题的,发现本地是正常的,linux服务器异常,仔细查找原因发现是strtotime函数获取的值和本地获取的值不一致,离真实的值小了8小时,网上查找资料才知道,是strtotime()里面的时间格式的问题,需要.....
分类:
Web程序 时间:
2015-02-03 19:03:16
阅读次数:
240
//时间长度$timelength= (strtotime($endtime)-strtotime($starttime))/60;var_dump($timelength."分钟");exit();
分类:
Web程序 时间:
2015-02-02 17:52:32
阅读次数:
172
1 /**2 * 日期-计算2个日期的差值3 * @return int4 */5 public function get_difference($date, $new_date) {6 $date = strtotime($da...
分类:
Web程序 时间:
2015-02-01 20:22:29
阅读次数:
154