Home  >  Article  >  Backend Development  >  这么比较日期对吗

这么比较日期对吗

WBOY
WBOYOriginal
2016-06-13 11:53:531094browse

这样比较日期对吗
if ("2014-03-18 09:15:31" echo 小
else
echo 大
好像行不通的样子,最后显示的是小
------解决方案--------------------
使用strtotime转换成时间搓比较就没问题了。

<br />if (strtotime("2014-03-18 09:15:31") < strtotime("2014-3-16 23:36:24")){<br />	echo '大';<br />}else{<br />	echo '小';<br />}<br />

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