i have 1 string like 8/29/2011 11:16:12 AM
i want to save in variable like $dat = 8/29/2011 and $tme = 11:16:12 AM
how would is possible? can you give me example?
i have 1 string like 8/29/2011 11:16:12 AM
i want to save in variable like $dat = 8/29/2011 and $tme = 11:16:12 AM
how would is possible? can you give me example?
E.g.
<?php
$s = '8/29/2011 11:16:12 AM';
$dt = new DateTime($s);
$date = $dt->format('m/d/Y');
$time = $dt->format('H:i:s');
echo $date, ' | ', $time;
see http://docs.php.net/class.datetime
edit: To keep the AM/PM format use
$time = $dt->format('h:i:s A');