我在JS中有一个datetime变量:
var date_start = dateFormat(newJobForm.time_start, "yyyy-mm-dd-HH-MM");
var date_end = dateFormat(newJobForm.time_end, "yyyy-mm-dd-HH-MM");
主要问题是:我无法仅显示会议记录
当我将日期传递给PHP的date()
函数时,由于:
和H
之间的i
,它不会保存它。我尝试explode()
与-
但它没有用。
URL是:my_controller/abcd^5^2012-10-15-15-15^2012-10-18-17-30
我的控制器在CakePHP中的动作是从JS获取时间:
$time_start = $explode_item[2];
$time_end = $explode_item[3];
$dateStart = strtotime ( date('Y-m-d H:i', $time_start) ) ;
$dateStartArray['Y'] = date ( 'Y' , $dateStart );
$dateStartArray['m'] = date ( 'm' , $dateStart );
$dateStartArray['d'] = date ( 'd' , $dateStart );
$dateStartArray['H'] = date ( 'H' , $dateStart );
$dateStartArray['i'] = date ( 'i' , $dateStart );
答案 0 :(得分:0)
我得到了答案:
控制器应为
$dateStart = date("Y-m-d H:i",strtotime ('+1 hour', strtotime (date("Y-m-d H:i",$time_start))));
$dateEnd = date("Y-m-d H:i",strtotime ('+1 hour', strtotime (date("Y-m-d H:i",$time_end))));
我们需要在js中将时间转换为Echop
var d = new Date(value); var epochtime = (d.getTime()-d.getMilliseconds())/1000;
完成! :)