Skip to content
Advertisement

PHP date add 5 year to current date

I have this PHP code:

$end=date('Y-m-d');

I use it to get the current date, and I need the date 5 years in the future, something like:

$end=date('(Y + 5)-m-d');

How can I do this?

Advertisement

Answer

Try with:

$end = date('Y-m-d', strtotime('+5 years'));
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement