LMSouq
php-dev Open

Adding days to $Date in PHP

IS
Istari
1 month ago
3 views
Problem Description
I have a date returned as part of a MySQL query in the form `2010-09-17`. I would like to set the variables $Date2 to $Date5 as follows: `$Date2 = $Date + 1` `$Date3 = $Date + 2` etc., so that it returns `2010-09-18`, `2010-09-19`, etc. I have tried date('Y-m-d', strtotime($Date. ' + 1 day')) but this gives me the date *before* `$Date`. What is the correct way to get my Dates in the format form 'Y-m-d' so that they may be used in another query?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base