Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get recoed between two datetime laravel

$startDate = Carbon::createFromFormat('Y-m-d', '2021-06-01');
$endDate = Carbon::createFromFormat('Y-m-d', '2021-06-30');

$posts = Post::query()
    ->whereDate('created_at', '>=', $startDate)
    ->whereDate('created_at', '<=', $endDate)
    ->get();
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #recoed #datetime #laravel
ADD COMMENT
Topic
Name
2+8 =