php - Laravel Carbon format method unexpected result -
i date of database:
$ticket = array('date' => '05-07-16 16:07:14') # day/month/year
in blade.php format date carbon:
{{ \carbon\carbon::parse($ticket['date'])->format('d-m-y') }}
this returns me -> '16-07-2005'
but want '05-07-16'
years , days not correct. 2016 year, , 05 day of month (07).
why format d-m-y not works me?
use createfromformat method in carbon
{{ \carbon\carbon::createfromformat('d-m-y h:s:i', $ticket['date'])->format('d-m-y') }}
Comments
Post a Comment