I have a datetime variable in JS which is:
var date_start = dateFormat(newJobForm.time_start, "yyyy-mm-dd-HH-MM");
var date_end = dateFormat(newJobForm.time_end, "yyyy-mm-dd-HH-MM");
The main problem is: I can’t show the minutes only
When I pass my dates to PHP’s date() function, because of the : between H and i, it won’t save it. I tried to explode() it with - but it didn’t work.
The URL is: my_controller/abcd^5^2012-10-15-15-15^2012-10-18-17-30 and my controller in CakePHP action to take the time from JS is:
$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 );
I got the answer:
controller should be
and we need to convert the time to Echop in js
Done ! 🙂