How can I get 10 days future date from today in Laravel (PHP)

Viewed 2038

I'm trying to get a future date from today using PHP.

like date('dS M, Y (D)') returns 21st Jan, 2021 (Thu) (Today)

How can we get a future date from today!

5 Answers

You could use the superb Carbon package by installing it via composer.

Then in your code you can run add days like this

Entering the date piece by piece

$dt = Carbon::create(2021, 1, 22, 0);
echo $dt->addDays(10); // adding 10 days from today on

Using now()

echo Carbon::now()->addDays(10); // adding 10 days from today on

You can use it that way. You don't need any package for this job.

$tenDaysLater = date ('Y-m-d', strtotime ('+10 day'));

try this code

$date = date('Y-m-d');
$addDay= strtotime($date . "+10 days"); 

echo date('Y-m-d', $addDay);

You could do this:

$datetime = Carbon::now()->addDays(30);
Related