Home  >  Article  >  Backend Development  >  PHP+MYSQL如何存储和读取格式化时间

PHP+MYSQL如何存储和读取格式化时间

WBOY
WBOYOriginal
2016-06-13 11:51:46835browse

PHP+MYSQL怎么存储和读取格式化时间。
注:只需要存储、读取和判断时间,不包括日期。。

开始时间:08:30:00
结束时间:18:00:00
在表单中输入如上格式的时间,可否用int类型存储到MYSQL数据库,又怎么用PHP读取打印出来?
并且可以判断服务器当前时间是否处于开始和结束之间。
------解决方案--------------------

$current = date("H:i:s");<br />if( $current >$time1 && $current < $time2){<br />     echo '之间';<br />}else{<br />     echo '非之间';<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