Split date into parts - PHP/Laravel/Carbon -
i'm starting integrate carbon website , can't seem able format wants.
carbon::create($year, $month, $day, $hour, $minute, $second, $tz); // initial data $day = 'today'; $time = '1100'; // convert them $d = date('y-m-d',strtotime($day)); $t = date('h:i:s',strtotime($time)); // end date = "2016-01-05" time":"11:00:00" how can split them php me extract $year, $month, $day, $hour, $minute, $second
so based on comments:
function converttime($day, $time){ $d = date('y-m-d-h-i-s',strtotime($day." +".$time)); $expd = explode("-", $d); $year = $expd[0]; $month = $expd[1]; $day = $expd[2]; $hour = $expd[3]; $minute = $expd[4]; $second = $expd[5]; return array($year, $month, $day, $hour, $minute, $second); }
Comments
Post a Comment