Are there any common pitfalls to avoid when working with time formatting in PHP?

One common pitfall when working with time formatting in PHP is forgetting to set the correct timezone before formatting a date or time. This can lead to incorrect results or unexpected behavior, especially when working with timestamps from different timezones. To avoid this issue, always set the timezone using the `date_default_timezone_set()` function before formatting any date or time.

// Set the timezone to the desired value
date_default_timezone_set('America/New_York');

// Format the current date and time
$currentTime = date('Y-m-d H:i:s');
echo $currentTime;