How to Get Current Date Time and Day in Laravel?

By Hardik Savani April 16, 2024 Category : Laravel

Hello Developer,

Now, let's see an example of how to get current date and time in laravel. I would like to show you how to get current date in laravel. This example will help you how to get current time in laravel. Here you will learn how to get current timestamp in laravel. follow the below step for laravel get current date.

You can use this example with laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11.

In this example, i will show you how to get current date, time, timestamp and day in laravel application. we will use now() helper function to get current carbon object. so, let's see the example one by one.

Example 1: Laravel Get Current Timestamps

Code:

$timestamp = now();

Output:

2023-05-19T03:48:36.721266Z

Example 2: Laravel Get Current Date

Code:

$date = now()->format('Y-m-d');

Output:

2023-05-19

Example 3: Laravel Get Current Time

Code:

$time = now()->format('H:i:s');

Output:

03:48:36

Example 4: Laravel Get Current Day

Code:

$time = now()->format('l');

Output:

Friday

I hope it can help you...

Tags :
Shares