How can i write date format in thinkphp

377 Views Asked by At

How can i write Date format in Thinkphp?

I given the below line in my coding

{$user.sdate}

It shows like 10-07-1991

but i want like 10:22pm, 10-jul-1991

Every format i tried but it does not work.

I tried this below one but no use

{$user.sdate|date="H:i dd-M-YYYY",###}


{$user.sdate|date="dd-M-YYYY",###}


{$user.sdate|date="H:i d-m-Y",###}

Please help me. Because i tried this from long days. I know this is just single step but i searched google. I am not getting .

2

There are 2 best solutions below

0
On BEST ANSWER
$date = date( 'H:i a , d-F-Y ', strtotime($user[0]['date']) ) ;

Output:

05:55 pm , 10-June-2017
5
On

Like this:

{$user.sdate|date="h:i a d-M-Y",###}