need to format date for Brazil in laravel

-2

Hello,

I need to show date 00-00-0000 how do I in this code below?

<span data-bind="text: created_at"></span>

Thanks for any help

    
asked by anonymous 09.01.2018 / 09:57

1 answer

2

To use this date pattern, you can use the native PHP function, the Date or Carbon (default class Laravel uses for date ), which is already installed in Laravel.

In the control use the code below as an example. Add% with%. Ex:

public function index()
{        
    $reviews = \App\Reviews::all();

    return view('home', ["reviews" => $reviews]);
}

In the view use

@foreach ($reviews as $review)
<span data-bind="text: {{ $review->created_at->format("d-m-Y") }}"></span>
@endforeach

If you want to change the format, simply replace dmY with any of the values in the following table: link

    
09.01.2018 / 10:14