How do i get 3 months after the date of today in php?
From PHP i’ll get todays date by date("Y-m-d"); lets say 2012-02-22
How i’ll get a date after 3 months…. i.e 2012-05-22
EDIT:-
The issue is about different number of days in different months, feb have 28 days also and 29 in leap… odd months 31 and others 30… Is there any pre-built function in php which i can use to deal with this issue… ??
EDIT 2
With all responses i understood that it would be a problem:-
In reference to https://stackoverflow.com/a/10275921/1182021 [+1]
So i think it would be better of writing a manual function for it… and i’ll put it here as an answer… Thanks for everyone help and support..
ANSWER TO THIS QUESTION
We need to check all the conditions manually for accurate calculations… there is no inbuilt function for this in PHP…. https://stackoverflow.com/a/10280441/1182021
This is a 100% working code to accomplish the task
We can check the stuff manually by using this piece of code in top:-
Just copy and paste the code, check it in your browser 🙂