php - How to echo a converted time format from mysql datetime column -


i'm trying convert datetimte shorter, error below.

warning: date_format() expects parameter 1 datetime, string given in ...

code

$datetime = '2012-03-24 17:45:12'; $time = date_format($datetime, 'g:i a'); echo $time; 

what i'm doing wring? thanks.

try datetime

$date = new datetime("2012-03-24 17:45:12"); echo $date->format("g:i a"); 

Comments

Popular posts from this blog

What can cause "Required Package 'IndyCore' not found" when compiling a Delphi 2010 project? -

Change the color of an oval at click in Java AWT -