What potential pitfalls should be avoided when working with dates and times in PHP?
One potential pitfall when working with dates and times in PHP is not properly handling time zones. It's important to always set the correct time zone when working with date and time functions to avoid discrepancies in calculations or display. You can set the default time zone in your PHP script using the `date_default_timezone_set` function.
// Set the default time zone to UTC
date_default_timezone_set('UTC');