Tags
Asked 3 years ago
9 Jun 2021
Views 219
david

david posted

how to get tomorrows date from date in php ?

how to Get tomorrows date from date in php ?
jabber

jabber
answered Apr 26 '23 00:00

You can get tomorrow's date from today's date using PHP's DateTime class and the modify () method to add one day to the current date. Here's an example:



$today = new DateTime();
$tomorrow = $today->modify('+1 day');
echo $tomorrow->format('Y-m-d'); // Output: 2023-04-27

In the above example, we create a new DateTime object for today's date. Then, we use the modify () method to add one day to the current date, which sets the date to tomorrow's date. Finally, we use the format() method to format the date in the desired format, which is 'Y-m-d ' (year-month-day).
Post Answer