Laravel Get Current Timestamp Example
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....
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial