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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

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

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -