i'm new php pprogrammer.
I need to help, how to convert the date format from yyyy-mm-dd to dd-mm-yyy.
I want to show on the query result as format dd-mm-yyy.
This is my output query:
<?php echo $row['date_posted'];?> the result is 2009-07-07
Please help me;
Thank you.
Convert the format date from yyyy-mm-dd to dd-mm-yyy
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Convert the format date from yyyy-mm-dd to dd-mm-yyy
You can probably do something like:
You could also use substr() to extract the day, month and year if you always know the input format.
Code: Select all
echo date('%d-$m-%y', strtotime($row['date_posted']));(#10850)