views:

412

answers:

3

I some php code which gets info from a mysql database. The problem is that the date is coming out in the format : 2010-02-03 22:21:26

Does anyone know a simple solution to make the date more user friendly format. e.g 2nd march 2010 at 22:21.

Thanks

+2  A: 

See strtotime() and date()

e.g., 2010-02-03 22:21:26 to 3rd February 2010 at 22:21:

$DateTimeStr = '2010-02-03 22:21:26';
echo date('jS F Y \a\t G:i', strtotime($DateTimeStr));
Dor
this worked beautifully, thanks a mil.
dave e
+1  A: 

date() function will assist you in this.

Something like

$date = date('j F, Y h:i:s', strtotime($date_value));
print $date;

Format options:

http://www.php.net/manual/en/function.date.php

Kevin
+2  A: 

Or use the datetime-class.

Frank Heikens