Skip to content
Advertisement

Add six months in php

I’m trying to get the month, six months out from the current date.

I’ve tried using:

date('d', strtotime('+6 month', time()));

But it doesn’t seem to work, always returns 01. Is there a better way to do this?

Thank you!

Advertisement

Answer

I find working with DateTime much easier to use:

JavaScript

or

JavaScript

or in PHP version 5.4+

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement