1<?php 2 3namespace Pterodactyl\Helpers; 4 5use Carbon\CarbonImmutable; 6 7final class Time 8{ 9 /** 10 * Gets the time offset from the provided timezone relative to UTC as a number. This 11 * is used in the database configuration since we can't always rely on there being support 12 * for named timezones in MySQL. 13 * 14 * Returns the timezone as a string like +08:00 or -05:00 depending on the app timezone. 15 */ 16 public static function getMySQLTimezoneOffset(string $timezone): string 17 { 18 return CarbonImmutable::now($timezone)->getTimezone()->toOffsetName(); 19 } 20} 21 22