php
界面传到PHP里面
2013-01-01 12:01:00
$endtime = $this->input->get('endtime');
$endtime = preg_replace('/[- :]/','',$endtime );
现在的格式
20130101120100
想实现的格式是
20130101000000
把时分秒替换为0 怎么实现? 大虾帮忙!
回复讨论(解决方案)
$s = '2013-01-01 12:01:00';
$s = date('Ymd000000', strtotime($s));
思路问题
既然格式是这样的 那其实就是 字符串的前8个数字+6个0
echo substr($endtime,0,8)."000000";
好吧 xu大的方法更合适的多...
$s = '2013-01-01 12:01:00';
$s = date('Ymd000000', strtotime($s));
版主爱你一万年
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn