Language

How To format laravel created_at date to d-m-Y format in Laravel 5.4

Date 12 Aug, 2017

Details :

1. You can format laravel created_at date into any format

date('d-M-Y', strtotime($value['created_at']));   //output  13-Aug-2017

date('d-m-Y', strtotime($value['created_at']));   //output  13-08-2017

date('d-m-y', strtotime($value['created_at']));   //output  13-08-17

Note: Yo can use comma , or slash / instead of hyphen - 

2. for time use following

date('d-M-Y h:i:s', strtotime($value['created_at']));   //output  13-Aug-2017 5:13:17

date('d-m-Y H:i:s', strtotime($value['created_at']));   //output  13-08-2017 17:13:17

date('h:i:s', strtotime($value['created_at']));   //output 5:13:17

date('H:i:s', strtotime($value['created_at']));   //output 17:13:17