2011年05月05日转换成时间戳 2011年05月05日转换成时间戳有没有好的方法,不是那种切割字符窜什么有没有自带函数可以解决的我就是想知道有没有自带函数,切字符窜的我会的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 strtotime可以,只要你是标准格式,例如,2011-05-05,这样就可以转换了$time=strtotime('2011-05-05'); strtotime -- 将任何英文文本的日期时间描述解析为 Unix 时间戳但是没有中文文本的 $time='2011年05月05日';$time1=str_replace('年','-',$time);$time1=str_replace('月','-',$time1);$time1=str_replace('日','',$time1);$time1=strtotime($time1);echo $time1;//1304553600 $time='2011年05月05日';$time1=str_replace(array('年','月','日'),array('-','-',''),$time);$time1=strtotime($time1);echo $time1; 先将年月日替换成-然后在strtotime $t = '2011年05月05日';$time = preg_replace('/(\d+)\D+(\d+)\D+(\d+)\D*/e', 'mktime(0,0,0,$2,$3,$1)', $t);//验证一下echo date('Y-m-d', $time); 数据统计! 发个Joomla帖。。。今天意外发现 双星 了,进来拿分 奇怪的问题? PHP zendstudio说连不上数据库 osCommerce 换服务器安装问题,追加我所有的分数求解或能帮我解决问题的朋友。急!!!!! PHP 安全问题 关于过滤数据 配置问题 不知道php中有没有文件内容搜索呢 win2000 环境下 php+apache 或php+iis 如何让getallheaders()生效?? 在线等待,include、require都不能解决 基础的显示问题 打听下
$time=strtotime('2011-05-05');
$time1=str_replace('年','-',$time);
$time1=str_replace('月','-',$time1);
$time1=str_replace('日','',$time1);
$time1=strtotime($time1);
echo $time1;//1304553600
$time='2011年05月05日';
$time1=str_replace(array('年','月','日'),array('-','-',''),$time);
$time1=strtotime($time1);
echo $time1;
然后在strtotime
$time = preg_replace('/(\d+)\D+(\d+)\D+(\d+)\D*/e', 'mktime(0,0,0,$2,$3,$1)', $t);
//验证一下
echo date('Y-m-d', $time);