$sessionquery = "
SELECT SessionDate
FROM Session
";
$sessionqrystmt=$mysqli->prepare($sessionquery);
// You only need to call bind_param once
$sessionqrystmt->execute();
$sessionqrystmt->bind_result($dbSessionDate);
$sessionHTML = '<select name="session" id="sessionsDrop">'.PHP_EOL;
$sessionHTML .= '<option value="">Please Select</option>'.PHP_EOL;
while ( $sessionqrystmt->fetch() ) {
$sessionHTML .= sprintf("<option value='%s'>%s</option>", $dbSessionDate) . PHP_EOL;
}
Above I have a drop down menu where it displays a Session’s Date. At the moment the date is formatted so it looks like this:
2012-03-23
I want it to be formatted as below:
23-03-2012
How can I change the date format in the drop down menu?
1 Answer