Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.



Get Started Now!

Get Current Date Time and Day in Laravel

Laravel

Let’s look at a Laravel example of how to obtain the current date and time. I’d want to demonstrate how to obtain the current date in Laravel. You can learn how to obtain the current time in Laravel with this example. You may discover how to obtain the most recent timestamp in Laravel here. for Laravel to obtain the current date, follow the steps below.

With Laravel 6, Laravel 7, Laravel 8, Laravel 9, and Laravel 10, you can apply this example.

I’ll demonstrate how to obtain the current date, time, timestamp, and day in a Laravel application in this example. To obtain the current carbon object, we will utilize the auxiliary method now(). Let’s examine each example one at a time.

Example 1: Laravel Get Current Timestamps

$timestamp = now();
// Output
2023-07-09T03:48:36.721266Z

Example 2: Laravel Get Current Date

$date = now()->format('Y-m-d');
// OutPut
2023-07-09

Example 3: Laravel Get Current Time

$time = now()->format('H:i:s');
// OutPut
03:48:36

Example 4: Laravel Get Current Day

$time = now()->format('l');
// output 
Friday
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x