What are the best practices for handling date calculations and output in PHP to achieve the desired result?

When handling date calculations and output in PHP, it's important to use the date() function along with strtotime() for accurate results. Additionally, it's recommended to set the default timezone using date_default_timezone_set() to avoid any timezone-related discrepancies. Lastly, formatting the output using the desired date format will ensure the desired result.

// Set the default timezone
date_default_timezone_set('America/New_York');

// Calculate and output the desired date
$today = date('Y-m-d');
$nextWeek = date('Y-m-d', strtotime('+1 week'));

echo "Today's date: $today\n";
echo "Date next week: $nextWeek";