i want to separate date, month, time, hour, min ,sec getting from database, for count down timer, in data base stored date is 2010/10/10: me using this code :
$m=date('m',$row['Date']);
$d=date('d',$row['Date']);
output is month=31 date = 12....
i want to separate date, month, time, hour, min ,sec getting from database, for count down timer, in data base stored date is 2010/10/10: me using this code :
$m=date('m',$row['Date']);
$d=date('d',$row['Date']);
output is month=31 date = 12....
If you want them separetely, you can use the explode function with list eg:
list($year, $month, $day) = explode('/', $row['Date']);
Also, you can use the strtotime function for getting individual values:
echo 'Day' . date('d', strtotime($row['Date']));
echo 'Month' . date('m', strtotime($row['Date']));
echo 'Year' . date('Y', strtotime($row['Date']));
$d = // Pull your date from the db
$date = new DateTime($d);
$day = $date->format('l'); // Creates day name
$day = $date->format('j') // Creates date number
$month = $date->format('n'); // Creates month number
$year = $date->format('Y'); // Creates year
..and so forth.
You can find formatting options here, http://php.net/manual/en/function.date.php