PASSWORD RESET

Your destination for complete Tech news

PHP

How to get tomorrow’s date in PHP?

762 0
< 1 min read

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.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.