Laravel Get Current Timestamp Example

10-Apr-2023

.

Admin

Today our leading topic is laravel carbon get current timestamp. step by step explain get current timestamp php laravel. i would like to share with you laravel carbon get current date time. This post will give you simple example of laravel carbon current timestamp. Follow bellow tutorial step of how to get current timestamp in laravel.

Example 1:


In this Example,you will use toDateTimeString() then get to current time and date.you can follow this example.

public function index()

{

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

dd($current_date_time);

}

Output :

2020-02-12 10:35:07

Example 2:

In this Example,you will use timestamp then get only current time. you can follow this example.

public function index()

{

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

dd($current_time);

}

Output :

1581503745

It will help you....

#Laravel 7

#Laravel

#PHP

#Laravel 6