PHP Classes

Adding 1 month

Recommend this page to a friend!

      Winged Date  >  All threads  >  Adding 1 month  >  (Un) Subscribe thread alerts  
Subject:Adding 1 month
Summary:Check for invalid dates
Messages:2
Author:John Haywood
Date:2016-11-06 14:05:06
 

  1. Adding 1 month   Reply   Report abuse  
Picture of John Haywood John Haywood - 2016-11-06 14:05:06
Looking forward to trying this Class out in the next few days as I'm specifically looking for an easy way to add 30 days to a given date in MySQL date format.
All other code and Classes I have come across seems to add 30 days but fails to test if the new date is actually a valid date or not - I need to be able to add 30 days, then if the date is invalid, to be able to remove 1 day until the date is valid.
e.g 30th January + 30 days gives an invalid date.

  2. Re: Adding 1 month   Reply   Report abuse  
Picture of Max Koshney Max Koshney - 2016-11-07 18:42:22 - In reply to message 1 from John Haywood
php.net/manual/en/class.datetime.ph ...

The PHP Datetime object would be where I would start as it does all kinds of manipulation perfectly.