2017.8.22学习日志——php添加datepicker并对比大小
来源:互联网 发布:淘宝店怎样设置客服 编辑:程序博客网 时间:2024/06/01 13:36
2017.8.22学习日志
继昨天学习怎么阅读和调试PHP代码之后,今天的效率快了很多,很多改动知道从哪地方下手。
那么今天的任务是按时间搜索每个人的工单情况,如愿以偿解决了问题。
首先我在需要添加功能的页面添加两个datepicker:
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"><script src="https://code.jquery.com/jquery-1.12.4.js"></script><script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script><script> $( function() { $( "#datepicker1" ).datepicker(); } ); $( function() { $( "#datepicker2" ).datepicker(); } );</script><form action="" method="get"> <div align="center">起止时间:<input type="text" id="datepicker1" name="datepicker1"> 至 <input type="text" id="datepicker2" name="datepicker2"> <input type="submit" value="开始"> </div></form>
我把datepicker的数据传递到本页面让PHP处理,值得一提的是,我是用的phpstorm开发工具,当我把提交方式设为”post”的时候,php接收良好,可以处理,可是以”get”方式传递则无法接收,调试echo打印
<?php $string= $_SERVER['QUERY_STRING']; $strarr = explode("&",$string); foreach($strarr as $id=>$arr) { $r=explode("=",$arr); $_GET[$r[0]]=urldecode($r[1]); } $datepicker1 = $_GET['datepicker1']; echo $datepicker1; $datepicker2 = $_GET['datepicker2']; echo $datepicker2;//或者直接用post传递参数也可,不知道为什么get不能传数据。?>
取得参数后,与已有的开始时间和完成时间对比,当开始和完成都在
<?php foreach($tasks as $task): $d1 = date("y-m-d",strtotime($task->finishedDate)); if(strtotime($task->realStarted)>=strtotime($datepicker1)&&strtotime($d1)<=strtotime($datepicker2)&&strtotime($d1)>=strtotime($datepicker1)&&strtotime($d1)<=strtotime($datepicker2)||strtotime($datepicker1)==0||strtotime($datepicker2)==0){ ?> <tr class='text-center'> <td><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id"), sprintf('%03d', $task->id));?></td> <td><span class='<?php echo 'pri' . zget($lang->task->priList, $task->pri, $task->pri);?>'><?php echo $task->pri == '0' ? '' : zget($lang->task->priList, $task->pri, $task->pri)?></span></td> <td class='nobr'><?php echo html::a($this->createLink('project', 'browse', "projectid=$task->projectID"), $task->projectName);?></td> <td class='nobr'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id"), $task->name);?></td> <td><?php echo $task->estimate;?></td> <td><?php echo $task->consumed;?></td> <td><?php echo $task->estimate-$task->consumed;?></td> <td><?php echo $task->realStarted;?></td> <td class=<?php if(isset($task->delay)) echo 'delayed';?>><?php if(substr($task->deadline, 0, 4) > 0) echo $task->deadline;?></td> <td><?php echo $task->finishedDate;?></td> <td class='<?php echo $task->status;?>'><?php echo $lang->task->statusList[$task->status];?></td> </tr> <?php $countestimate += $task->estimate; $countconsumed += $task->consumed; $countleft += $task->estimate-$task->consumed; ++$counttask;} endforeach;?>
重点是时间对比大小,需要使用到php中的strtotime方法,把日期转换成时间戳形式,1502441119这种来对比大小,通过d1=date("y−m−d",strtotime( task->finishedDate))方法去除后面的时分秒。
以上是今天的总结。
阅读全文
0 0
- 2017.8.22学习日志——php添加datepicker并对比大小
- android学习——DatePicker 和 TimePicker
- Silverlight 学习——重写DatePicker
- Silverlight 学习——重写DatePicker (二)
- PHP 学习日志——httpd.conf
- datePicker改变大小问题
- Android开发————DatePicker学习笔记
- Android学习笔记之——DatePicker&TimePicker
- android学习笔记——DatePicker、TimePicker探究
- DatePicker学习
- PHP每日学习日志——运算符
- Oracle的日志缓冲区大小查询方法———学习笔记
- QCombox添加QIcon并设置其大小
- 更改日志大小及添加日志组成员
- 添加时间选择器--DatePicker
- PHP语言学习日志
- php学习日志
- 日期选择器——datepicker
- Unity ShaderLab(二) 支持透明的边缘发光Shader
- setFocusable与setFocusableInTouchMode差异以及clickable
- 链表--稀疏矩阵
- Palindrome Number判断回文数
- js注入实现分析
- 2017.8.22学习日志——php添加datepicker并对比大小
- [LintCode 433] 岛屿的个数(Python)
- lintcode Range Sum Query 2D
- vue嵌套路由-query传递参数(三)
- 关闭软键盘的方法
- centos安装python3
- 【物联网云端对接-3】通过MQTT协议与微软Azure IoT Hub进行云端通信
- typeof检测到的数据类型有哪些?
- 代理模式