$date = date("Y-m-d"); echo $date; // Output: 2021-11-15
$date = date("l, F j, Y g:i a"); echo $date; // Output: Monday, November 15, 2021 1:55 pm
$date = strtotime("next Monday"); echo date("Y-m-d", $date); // Output: 2021-11-22
use Carbon\Carbon; $date = Carbon::now(); echo $date->toFormattedDateString(); // Output: Nov 15, 2021
use Carbon\Carbon; $date = Carbon::parse('2021-11-15'); echo $date->subWeeks(1)->format('Y-m-d'); // Output: 2021-11-08In this example, the `Carbon` library is used to parse a string representation of a date and create a new instance. The `subWeeks()` method is then used to subtract one week from the date, and the `format()` method is used to format the resulting date in the format of `YYYY-MM-DD`.