Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a mysql date (datetime) into a better date format using php

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.
like image 940
DaveE Avatar asked Mar 28 '10 16:03

DaveE


1 Answers

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));
like image 67
Dor Avatar answered Sep 28 '22 12:09

Dor