How to get Current Timestamp from Carbon in Laravel 5

前端 未结 7 1650
天涯浪人
天涯浪人 2021-02-01 01:05

I want to get current timestamp in laravel 5 and I have done this-

$current_time = Carbon\\Carbon::now()->toDateTimeString();

I am getting e

7条回答
  •  情话喂你
    2021-02-01 01:12

    It may be a little late, but you could use the helper function time() to get the current timestamp. I tried this function and it did the job, no need for classes :).

    You can find this in the official documentation at https://laravel.com/docs/5.0/templates

    Regards.

提交回复
热议问题