thinkphp 关于标准时间存入数据库的有关问题

WBOY
Release: 2016-06-13 12:22:22
Original
1574 people have browsed it

thinkphp 关于标准时间存入数据库的问题
比如我页面上面开始时间一项填写2015-06-01,然后点击保存,就能以时间戳保存进数据库

在thinkphp 我用原生的方式写,这样为什么存进去的时间为0
$_POST['sday']=strtotime('Y-m-d');
$this->assign('sday',$sday);
thinkphp方式应该如何写呢
------解决思路----------------------
打印一下  $sday
------解决思路----------------------
strtotime('Y-m-d');
Y-m-d改为日期
如:echo strtotime('9:20pm');格式有很多种

------解决思路----------------------
你把'9:20pm'改为你动态的值就可以了啊
int strtotime ( string $time [, int $now ] )
$time 为一个时间字符串,你的 'Y-m-d'显然不是时间字符串

$day='2015-06-01';
echo strtotime($day);
------解决思路----------------------

$sday = strtotime($_POST['sday']);<br />$this->assign('sday', $sday);
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template