Reputation: 33966
I'm retrieving only dates from database from a DATETIME column named Date.
Using DATE(Date) I get just the date in this order: 2012-02-19
SELECT DATE(Date)
echo $row['Day'];
How can I echo the date, day first, then month and last year. (As it's commonly ordered in Spanish)
Upvotes: 2
Views: 5836
Reputation: 2771
Convert the date from the SQL into a PHP date and then use the date()
function:
echo date("d-m-Y",strtotime($row['Day']));
Upvotes: 6
Reputation: 382806
Specify your new format to date
function like this:
echo date('d-m-Y', strtotime($row['Day']));
Upvotes: 1