Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to calculate what is date after 10 days in php?

Suppose the $start_date = 2017-12-13.

And i want to know what should be date after 10 days.

i tried this strtotime("$start_date +10 days") and the output is 1512946800

like image 369
sam Avatar asked Dec 02 '25 09:12

sam


1 Answers

You got the timestamp as value, now you just need to format it back to date.

date("y-m-d HH:mi:ss", strtotime("$start_date +10 days"))
date("Y-m-d", strtotime("$end_date -10 days")); //for minus

That should take care of it.

like image 161
Blakdronzer Avatar answered Dec 04 '25 22:12

Blakdronzer



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!