whereDate() is a Laravel Eloquent query method that filters records by the date portion of a datetime column, ignoring the time component entirely. It’s available in Laravel 10, 11, and 12 and works on any column that stores a date or datetime value. You use it whenever you want all records from a specific calendar date — regardless of what time those records were created or updated.
:::note[TL;DR]
whereDate('column', 'YYYY-MM-DD')matches records where the date part equals the given date- It ignores the time component —
created_atvalues like2025-12-25 14:30:00still match2025-12-25 - A plain
where('created_at', '2025-12-25')fails because datetime columns include time - Supports operators:
=,<>,>,>=,<,<= - Works on any date or datetime column, not just
created_at:::
What is the syntax for whereDate()?
The method takes a column name, an optional operator, and a date string. When you omit the operator, it defaults to =.
Model::whereDate('column', 'YYYY-MM-DD')->get();
// or with an explicit operator:
Model::whereDate('column', '>=', 'YYYY-MM-DD')->get();
The date string must be in YYYY-MM-DD format. Laravel passes this to the underlying database’s DATE() function, which strips the time component before comparing.
Why does a plain where() fail for date filtering?
Scenario: You need all orders placed on Christmas day — December 25, 2025. Your
created_atcolumn stores full datetimes like2025-12-25 09:14:00. A rawwhere('created_at', '2025-12-25')matches nothing because2025-12-25doesn’t equal2025-12-25 09:14:00.whereDate()handles this correctly regardless of the stored time.
The core issue is type mismatch. A datetime column stores both date and time. Comparing it directly against a date string only matches rows where the time is exactly midnight (00:00:00). That’s almost never what you want.
whereDate() wraps the column in the database’s DATE() function before comparing, so 2025-12-25 09:14:00 becomes 2025-12-25 for the purpose of the comparison.
Here’s the difference in practice. This version will almost certainly return zero results:
// Wrong — only matches rows where time is exactly 00:00:00
$orders = Order::where('created_at', '2025-12-25')->get();
This version works correctly:
// Correct — matches all rows from December 25, regardless of time
$orders = Order::whereDate('created_at', '2025-12-25')->get();
Both generate different SQL under the hood. The second one becomes WHERE DATE(created_at) = '2025-12-25'.
How do I filter records from today or a specific date range?
You can combine whereDate() with Carbon for dynamic date comparisons. Pass a Carbon instance or a formatted string — either works.
This example fetches all users registered today:
use Carbon\Carbon;
$todayUsers = User::whereDate('created_at', Carbon::today())->get();
To get records from a date range, chain two whereDate() calls. This retrieves orders placed between January 1 and January 31, 2025:
$januaryOrders = Order::whereDate('created_at', '>=', '2025-01-01')
->whereDate('created_at', '<=', '2025-01-31')
->get();
You can also use it on non-timestamp columns. Here’s filtering users by birth date:
$birthdayUsers = User::whereDate('birth_date', Carbon::today()->format('Y-m-d'))->get();
Can I use comparison operators with whereDate()?
Yes. All standard SQL comparison operators work. Pass the operator as the second argument and the date as the third.
// Records created before a specific date
$oldOrders = Order::whereDate('created_at', '<', '2025-01-01')->get();
// Records created on or after a date
$recentOrders = Order::whereDate('created_at', '>=', '2025-06-01')->get();
// Records NOT created on a specific date
$otherDays = Order::whereDate('created_at', '<>', '2025-12-25')->get();
Supported operators: =, <>, >, >=, <, <=.
How does whereDate() work with orWhere?
Chain orWhereDate() to add OR conditions. Same parameter signature as whereDate().
This query fetches orders from either Christmas or New Year’s Day:
$holidayOrders = Order::whereDate('created_at', '2025-12-25')
->orWhereDate('created_at', '2026-01-01')
->get();
:::warning
whereDate() wraps the column in DATE(), which prevents the database from using an index on that column. On large tables, this causes a full table scan. For performance-critical queries on large datasets, consider filtering a datetime range with whereBetween('created_at', ['2025-12-25 00:00:00', '2025-12-25 23:59:59']) instead — this is index-friendly.
:::
Summary
whereDate()filters by the date part of a datetime column, stripping the time before comparison- A plain
where()against a datetime column won’t match unless the time is exactly00:00:00 - Use Carbon for dynamic date values —
Carbon::today(),Carbon::yesterday(), etc. - All six comparison operators work:
=,<>,>,>=,<,<= - On large tables,
whereBetweenon the full datetime range performs better because it’s index-friendly
FAQ
What format does whereDate() expect?
Pass a date string in YYYY-MM-DD format, a Carbon instance, or any value that Laravel can cast to a date. Carbon instances are the safest option for dynamic dates.
Does whereDate() work with soft-deleted models?
Yes. It works like any other where clause and respects the SoftDeletes trait. Soft-deleted records are excluded by default. Use withTrashed() if you need them.
Can I use whereDate() on a column that stores only a date (not datetime)?
Yes. The DATE() function wrapping is a no-op on a pure date column — the value is already a date. It works the same way.
Is whereDate() available in Laravel 10, 11, and 12? Yes. It’s been part of Eloquent’s query builder for many major versions, including 10, 11, and 12.
What happens if the date string is in the wrong format?
The database will receive a malformed date string and the query will likely return no results or throw a database error, depending on your DB’s strict mode settings. Always use YYYY-MM-DD or a Carbon instance.
What to Read Next
- Laravel Eloquent whereTime() Method Explained — filter records by the time portion of a datetime column
- Get Last 30 Days Records in Laravel — practical date range filtering with Eloquent
- Laravel firstOrCreate(): Find or Create a Record — another Eloquent shortcut worth knowing