Hello Developer,Hello Dev,
In this short guide, we will show you how to get current date and time in laravel. This article goes in detailed on how to get current date in laravel. you'll learn how to get current time in laravel. I explained simply about how to get current timestamp in laravel. Alright, let’s dive into the steps.
You can use this example with laravel 6, laravel 7, laravel 8, laravel 9 and laravel 10.
In this example, i will show you how to get current date, time, timestamp and day in laravel application. we will use now()
Example 1: Laravel Get Current Timestamps
$timestamp = now();
Example 2: Laravel Get Current Date
$date = now()->format('Y-m-d');
Example 3: Laravel Get Current Time
$time = now()->format('H:i:s');
Example 4: Laravel Get Current Day
$time = now()->format('l');
I hope it can help you...
Do you like below Tutorials ?
- How to Open URL in New Tab using Jquery?
- Laravel 7.x and 6.x Routing Tutorial
- Ng Bootstrap Modal in Angular 8 Example
- Bootstrap 4 Datepicker in Angular 9/8 Example
- Disable Registration Route in Laravel
- Bootstrap Timepicker in Angular Example
- Count Number of Pages in PDF - PHP Script
- Digital Signature PHP Script Example