OM The Eternity
OM The Eternity

Reputation: 16204

How to convert "2011-02-14 16:14:57" into DD/MM/YYYY format in PHP?

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

Answers (3)

Harish
Harish

Reputation: 2324

$n      =   "2011-02-14 16:14:57";
echo $time_output=date("d/m/Y",strtotime($n));

Upvotes: 0

Developer
Developer

Reputation: 8636

Check this

Convert to date format dd/mm/yyyy

Upvotes: 0

StasM
StasM

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

Related Questions