Site icon Hip-Hop Website Design and Development

Why do I need to set my PHP timezone when it’s already set in WordPress?

I have WordPress set to Los Angles time in Settings > General. In my database I have a DATETIME column. When I use $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value_from_db); and then $dt->format('n/j/y @ g:iA T'); it displays the timezone as "UTC". In functions.php if I add date_default_timezone_set( get_option('timezone_string') ); then $dt will output correctly with "PST".

It works, but I didn’t think I needed to explicitly set the timezone since I already set it in WordPress. Am I doing something wrong or is this the correct way to set the timezone for my PHP?