Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 990
Aniket Das Avatar asked Oct 19 '25 11:10

Aniket Das


1 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
like image 119
codedge Avatar answered Oct 22 '25 04:10

codedge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!