[RESOLVED] Add a month to a strftime('%x') date
I have a date('d/m/y') date added to a MySQL database & then gotten & displayed on a page. How do I get the same date from the MySQL database (displayed as dd/mm/YY) & add 1 month.
Any help would be appreciated.
Last edited by mattwidge; 10-24-2009 at 07:39 PM.
You could add it as another field to select from your query:
Alternatively, if you've converted the query result into a UNIX timestamp integer in your code:
SELECT `date_col`, `date_col` + INTERVAL 1 MONTH AS `next_month` FROM . . .
$nextMonth = strtotime('+1 month', $timestampValueFromDB);
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
I've found a way that instead of displaying a month from a certain date, it shows the last day of the month instead. This suits my needs fine.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread