xxxxxxxxxx
// Assuming you have the user's timezone identifier, e.g., 'America/New_York'
$timezoneIdentifier = 'America/New_York';
$timezone = new DateTimeZone($timezoneIdentifier);
// Get current date and time
$now = new DateTime('now', $timezone);
// Output the timezone offset in hours and minutes
$offset = $timezone->getOffset($now) / 3600; // convert offset to hours
$offsetMinutes = ($offset - (int) $offset) * 60; // get the minutes
$offsetString = sprintf('%+03d:%02d', $offset, $offsetMinutes);
echo "User's timezone offset: $offsetString";
xxxxxxxxxx
echo date_default_timezone_get(); //UTC
//Read more at https://www.php.net/manual/en/function.date-default-timezone-get.php