concrete/src/Database/Connection/Timezone.php
public function getDeltaTimezone($phpTimezone)
    {
        if (!($phpTimezone instanceof DateTimeZone)) {
            $phpTimezone = new DateTimeZone($phpTimezone);
        }
        $data = $this->getDatabaseTimestamps();
        extract($data);
        $sometimesSame = false;
        $maxDeltaMinutes = 0;
        foreach ($timestamps as $index => $timestamp) {
            $databaseValue = new DateTime($databaseDatetimes[$index], $phpTimezone);
            $phpValue = DateTime::createFromFormat('U', $timestamp, $phpTimezone);
            $deltaMinutes = (int) floor(($phpValue->getTimestamp() - $databaseValue->getTimestamp()) / 60);
            if ($deltaMinutes === 0) {
                $sometimesSame = true;
            } else {
                if (abs($deltaMinutes) > abs($maxDeltaMinutes)) {
                    $maxDeltaMinutes = $deltaMinutes;
                }
            }
        }

        if ($maxDeltaMinutes === 0) {
            return null;
        } else {
            return [
                'dstProblems' => $sometimesSame,
                'maxDeltaMinutes' => $maxDeltaMinutes,
            ];
        }
    }
public function getDeltaTimezone($phpTimezone)
    {
        if (!($phpTimezone instanceof DateTimeZone)) {
            $phpTimezone = new DateTimeZone($phpTimezone);
        }
        $data = $this->getDatabaseTimestamps();
        extract($data);
        $sometimesSame = false;
        $maxDeltaMinutes = 0;
        foreach ($timestamps as $index => $timestamp) {
            $databaseValue = new DateTime($databaseDatetimes[$index], $phpTimezone);
            $phpValue = DateTime::createFromFormat('U', $timestamp, $phpTimezone);
            $deltaMinutes = (int) floor(($phpValue->getTimestamp() - $databaseValue->getTimestamp()) / 60);
            if ($deltaMinutes === 0) {
                $sometimesSame = true;
            } else {
                if (abs($deltaMinutes) > abs($maxDeltaMinutes)) {
                    $maxDeltaMinutes = $deltaMinutes;
                }
            }
        }

        if ($maxDeltaMinutes === 0) {
            return null;
        } else {
            return [
                'dstProblems' => $sometimesSame,
                'maxDeltaMinutes' => $maxDeltaMinutes,
            ];
        }
    }
public function getDeltaTimezone ( $ phpTimezone ) { if ( ! ( $ phpTimezone instanceof DateTimeZone ) ) { $ phpTimezone = new DateTimeZone ( $ phpTimezone ) ; } $ data = $ this -> getDatabaseTimestamps ( ) ; extract ( $ data ) ; $ sometimesSame = false ; $ maxDeltaMinutes = 0 ; foreach ( $ timestamps as $ index => $ timestamp ) { $ databaseValue = new DateTime ( $ databaseDatetimes [ $ index ] , $ phpTimezone ) ; $ phpValue = DateTime :: createFromFormat ( 'U' , $ timestamp , $ phpTimezone ) ; $ deltaMinutes = ( int ) floor ( ( $ phpValue -> getTimestamp ( ) - $ databaseValue -> getTimestamp ( ) ) / 60 ) ; if ( $ deltaMinutes === 0 ) { $ sometimesSame = true ; } else { if ( abs ( $ deltaMinutes ) > abs ( $ maxDeltaMinutes ) ) { $ maxDeltaMinutes = $ deltaMinutes ; } } } if ( $ maxDeltaMinutes === 0 ) { return null ; } else { return [ 'dstProblems' => $ sometimesSame , 'maxDeltaMinutes' => $ maxDeltaMinutes , ] ; } }
Check if a PHP time zone is compatible with the database timezone.

@param DateTimeZone|string $phpTimezone

@throws \Exception throws an Exception if $phpTimezone is not recognised as a valid timezone

@return null|array If the time zone matches, we'll return null, otherwise an array with the keys 'dstProblems' (boolean) and 'maxDeltaMinutes' (int)
Check if a PHP time zone is compatible with the database timezone .