Hi dev,
Today, i show you laravel 10 get current date time and day. This article will give you simple example of laravel 10 get current date time and day. you will laravel 10 get current date time and day. In this article, we will implement a laravel 10 get current date time and day.
current date, time, timestamp and day in laravel 10 application. we will use now() helper function to get current carbon object.
you can use this example with laravel 6, laravel 7, laravel 8, laravel 9 and laravel 10 version.
So, let’s follow few steps to create example of laravel 10 get current date time and day.
Laravel Get Current Timestamps
Code:
$timestamp = now();
Output:
2023-05-19T06:00:36.722266Z
Laravel Get Current Date
Code:
$date = now()->format('Y-m-d');
Output:
2023-05-19
Laravel Get Current Time
Code:
$time = now()->format('H:i:s');
Output:
06:08:36
Laravel Get Current Day
Code:
$time = now()->format('l');
Output:
Friday
I hope it will assist you…