$date = Carbon::now(); echo $date->toDateString(); // Outputs: "2022-06-16"
$date = Carbon::createFromFormat('Y-m-d H:i:s', '2022-06-16 10:30:00'); echo $date->addWeek()->format('m/d/Y H:i:s'); // Outputs: "06/23/2022 10:30:00"In this example, we first create a new Carbon instance using a custom date/time format. We then modify the date by adding a week to it using the addWeek method. Finally, we format the date as a string using the format method. The result is a date string that is exactly one week later than our original date.