I am trying to get the timezone format to just show -6 rather than -06:00 but can't figure this out.
My current code outputs the format (since I am in central time) as -21600
SO I am trying to convert this using the following...
$time_offset_get = new \DateTime('now', new DateTimeZone(America/Chicago));
$conn_timezone_offset = $time_offset_get->format('P');
But of course, this ($conn_timezone_offset) is giving me -06:00 Is there another format code that will do this correctly or am I am doing this wrong altogether.
Overall, I am just trying to convert a timezone offset name like America/Chicago or a 3 digit timezone code into a number offset without the colon using PHP.