Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Helpers/Time.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Helpers;
4
5
use Carbon\CarbonImmutable;
6
7
final 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