How can newer PHP features like DateTime be utilized to improve date manipulation and output?

When working with dates in PHP, the DateTime class can greatly simplify date manipulation and output. By using DateTime, you can easily create, modify, and format dates without the need for complex string parsing or calculations.

// Create a new DateTime object with the current date
$today = new DateTime();

// Modify the date by adding 1 day
$today->modify('+1 day');

// Format the date in a specific format
echo $today->format('Y-m-d');