84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
php中,怎样把类似2015年1月1号这样的数据转化为时间戳,日期可能是一位,也可能是两位,例如2015年11月4号,2015年4月11号,等等。
<?php /** * Created by PhpStorm. * User: Bruce * Date: 15/12/3 * Time: 下午2:06 */ $arr = date_parse_from_format ( "Y年m月d日" , "2015年10月12日" ); $timestamp = mktime(0,0,0,$arr['month'],$arr['day'],$arr['year']); echo $timestamp;
<?php header('Content-Type: text/plain;charset=utf-8'); $arr = date_parse_from_format('Y年m月d日', '2015年10月1日'); //下面3个输出都是1443628800 echo strtotime('2015-10-1')."\n"; echo strtotime($arr['year'].'-'.$arr['month'].'-'.$arr['day'])."\n"; echo mktime(0, 0, 0, $arr['month'], $arr['day'], $arr['year']); // 参数:时,分,秒,月,日,年
strtotime('2015-10-10');
strtotime('2015-10-10');