echo date('Y-m-d', strtotime('next Monday'));
echo (new DateTime('2023-12-25'))->format('Y-m-d');
code
Date Formatting for Specific Date ('Y-m-d')
This PHP code demonstrates two methods for working with dates. The first line uses `strtotime()` with `date()` to convert a relative time string (such as "next Monday") into a formatted date (YYYY-MM-DD). The second line utilizes a `DateTime` object to specify a particular date (December 25, 2023) and format it similarly, resulting in a standardized and easily readable date output.
Date formatting
strtotime function
Backend development
Date manipulation
Specific date