date format in laravel code example

Example 1: datetime format laravel

//laravel method 1
{{ $data->created_at->isoFormat('dddd D') }}

//laravel method 2 
{!! date('d/M/y', strtotime($data->created_at)) !!}

Example 2: format date laravel timestamp view

date('d-m-Y', strtotime($user->from_date));
/**
or
**/
date_format($user->from_date,'D M Y')

Example 3: laravel datepicker date format

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
    $( function() {
        $('.date').datepicker();        
    });
</script>

Example 4: format time laravel

{{\Carbon\Carbon::createFromFormat('H:i:s',$time)->format('h:i')}}

{{$item->date_seance->format('d/m/Y') }}

{{date('H:i', strtotime($item->start_time)) }}

Example 5: format date laravel timestamp view

date('d-m-Y', strtotime($user->from_date));

Example 6: blade format date

{!! htmlspecialchars_decode(date('j<\s\up>S</\s\up> F Y', strtotime('21-05-2020'))) !!}

Tags:

Php Example