In PHP, you can get tomorrow’s date using the date()
function along with the strtotime()
function. Here’s an example:
$tomorrow = date('Y-m-d', strtotime('+1 day'));
echo $tomorrow; // Output: the date string for tomorrow in YYYY-MM-DD format
In this example, we use the strtotime()
function to add one day to the current date, and then pass the resulting timestamp to the date()
function to format it in the desired YYYY-MM-DD format.
If you want to get the date string for a different day, you can modify the strtotime()
function argument accordingly. For example, to get the date string for two days from now, you can change the strtotime()
argument to +2 day
. The full list of time-related expressions that can be used with the strtotime()
function is available in the PHP documentation.