Reputation: 16204
I have a task to display the date in DD/MM/YYYY format, But I Have date stored as "2011-02-14 16:14:57" format, hence how can i convert it to get the DD/MM/YYYY in PHP?
Upvotes: 0
Views: 318
Reputation: 2324
$n = "2011-02-14 16:14:57";
echo $time_output=date("d/m/Y",strtotime($n));
Upvotes: 0
Reputation: 11012
echo date("d/m/Y", strtotime("2011-02-14 16:14:57"));
If you want more ways to do it, see PHP datetime extension.
Upvotes: 4