iamjonesy iamjonesy - 4 years ago 183
PHP Question

CodeIgniter: format mysql DATETIME field dd/mm/yy hh:mm

Hi pretty much what it says on the tin.

I have a datetime mysql field I want to output in the format dd/mm/yyyy hh:mm like 07/01/2011 22:16.

I've tried:

$datestring = '%d/%m/%Y %h:%i';
echo mdate($datestring,$row->created);

But I'm getting an error:

Message: A non well formed numeric value encountered

Any help most appreciated!



Answer Source


echo date ("d/m/Y h:ia",strtotime($row->created));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download