php 时间戳
来源:互联网 发布:秋天 连衣裙 搭配 知乎 编辑:程序博客网 时间:2024/05/18 01:06
今天这个时间戳困扰了我好久,之前是这样写的:
if(strtotime('now') > strtotime(date('Y-m-d H:i:s',strtotime('+8 hours')))
&& strtotime('now') <strtotime(date('Y-m-d H:i:s',strtotime('+8 hours'))))
//当在当天早上8点到晚上8点
{
$date= "8:00";
}
else if(strtotime('now') > (date('Y-m-d H:i:s',strtotime('+8 hours')))
//当在当天之后晚上8点
{
$date= "20:00";
}
结果那天到下午4点后$date="20:00"了;后来调试才发现,strtotime(date('Y-m-d H:i:s',strtotime('+8 hours')))是以当前时间为基准的,后来改为
if(strtotime('now') > strtotime(date('Y-m-d H:i:s',strtotime('today')+60*60*8))
&& strtotime('now') < strtotime(date('Y-m-d H:i:s',strtotime('today')+60*60*20)))
{
$_SESSION["zwork_time"]= "8:00";
}
else if(strtotime('now') > strtotime(date('Y-m-d H:i:s',strtotime('today')+60*60*20)) )
{
$_SESSION["zwork_time"]= "20:00";
}
- PHP 时间戳 与 时间
- php 时间戳
- PHP时间戳
- php处理时间戳
- PHP 时间戳 timestamp
- php时间戳函数
- PHP时间戳
- php时间戳
- php 格式化时间戳
- php 时间戳
- php 时间戳函数
- PHP时间戳详解
- php 时间戳比较
- PHP获取时间戳
- php 时间戳
- php时间戳
- php最近几天时间戳
- php时间戳常用
- Oracle之Check约束实例详解
- 将一个数组的非零元素移动到数组的前面,零元素置于数组的后面
- js如何判断用户是否是用微信浏览器
- yii 构建search 数据源data
- 捉虫经历
- php 时间戳
- jsp 乱码
- 栈和队列的基本操作实现
- 如何发表高水平论文(转载)
- 【网络流】 POJ 3422 Kaka's Matrix Travels
- 第十一周项目6 判断回文数
- jQquery选择器
- opencv图像处理-卷积
- QT Demo 之 imageelements