@ 2025-02-04T20:40:28Z <?php
$tz_string = 'Europe/Paris';
$timezone_utc = timezone_open('UTC');
$timezone = timezone_open($tz_string);
//$lasttimestamp = time();
//$lasttimestamp = 1743296400;
//$lasttimestamp = 1729990800;
//$lasttimestamp = 4141328400;
$lasttimestamp = 4160077200;
$lasttimestamp2 = '' . $lasttimestamp;
$to_min = strtr($lasttimestamp2, array('-2147483648' => '-2147483647', '-2147483647' => '-2147483647', '2147483647' => '2147483646'));
$to_min = (int) $to_min;
$to_min = '' . $to_min;
$to_min = strtr($to_min, array('-2147483648' => '2147483647'));
$to_min = (int) $to_min;
$from_max = 2147483647;
$to_min2 = 2147483647;
if($to_min > 2147483647 || -2147483648 > $to_min) {
$from_max = '2147483648';
$from_max = (int) $from_max;
} elseif($to_min < 2147483647) {
$to_min2 = 2147483646;
}
if($from_max > $to_min2) {
$lasttimestamp = (int) $lasttimestamp;
$timestampsec = '+0 sec';
$date1 = date_create('1970-01-01 00:00:00', $timezone_utc);
$date2 = date_modify($date1, $timestampsec);
$obj_rt = is_object($date2);
$key3 = 1;
$key4 = 1;
if($obj_rt) {
$transitions = timezone_transitions_get($timezone, $lasttimestamp);
$count = count($transitions);
if(2 > $count) {
$transitions2 = timezone_transitions_get($timezone);
$key2 = count($transitions2) - 1;
$offset3 = $transitions2[$key2]['offset'];
$lasttimestamp2 = $transitions2[$key2]['ts'];
$check = $lasttimestamp2 > $lasttimestamp;
if(!$check) {
$lasttimestamp2 = 4160077200;
$transitions3 = timezone_transitions_get($timezone, $lasttimestamp2);
$offset4 = $transitions3[0]['offset'];
if(7200 == $offset4) {
/*foreach($transitions2 as $key => $transition) {
if($lasttimestamp < $transition['ts']) {
if($key2 > $key) {
$key2 = $key;
}
}
}*/
$key3 = $key2 - 1;
$key4 = 0;
if($key2 > 0) {
$key4 = 1;
} else {
$key3 = 0;
}
//$transitiontimestamp = array($transitions2[$key3], $key4 => $transitions2[$key2]);
// code here
$arr = explode('T', $transitions[0]['time']);
$copy = $arr[0];
$arr = explode('+', $arr[1]);
$string = $copy . ' ' . $arr[0];
$date2 = null;
$date1 = null;
unset($date2);
unset($date1);
$string = strtr($string, array('+' => ''));
$date1 = date_create($string, $timezone_utc);
$offset1 = $transitions[0]['offset'];
$timestampsec = '+';
if(0 > $offset1) {
$timestampsec = '';
}
$timestampsec = $timestampsec . $offset1 . ' sec';
$date2 = date_modify($date1, $timestampsec);
$string = date_format($date2, 'Y-m-d H:i:s');
$date2 = null;
$date1 = null;
unset($date2);
unset($date1);
$date1 = date_create($string, $timezone);
$offset2 = date_format($date1, 'Z');
$offset2 = (int) $offset2;
if($offset1 != $offset2) {
$key4 = $key3;
//$offset3 = $transitions2[$key2]['offset'];
if($offset2 == $offset3) {
$key4 = $key2;
}
$transitions[0]['offset'] = $transitions2[$key4]['offset'];
$transitions[0]['isdst'] = $transitions2[$key4]['isdst'];
$transitions[0]['abbr'] = $transitions2[$key4]['abbr'];
}
}
}
$key3 = 0;
$key4 = 0;
} elseif($transitions[0]['ts'] == $transitions[1]['ts']) {
unset($transitions[1]);
if(3 > $count) {
$key3 = 0;
$key4 = 0;
} else {
$key3 = 2;
}
}
$transitiontimestamp2 = array($transitions[0], $key4 => $transitions[$key3]);
} else {
//
//$transitions2 = timezone_transitions_get($timezone);
}
}
var_dump($transitiontimestamp2[0], $offset1, $offset2, $offset4);
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.2.0 - 8.2.27 , 8.3.0 - 8.3.16 , 8.4.1 - 8.4.3 Warning: Undefined variable $offset1 in /in/FGbtV on line 117
Warning: Undefined variable $offset2 in /in/FGbtV on line 117
array(5) {
["ts"]=>
int(4160077200)
["time"]=>
string(25) "2101-10-30T01:00:00+00:00"
["offset"]=>
int(3600)
["isdst"]=>
bool(false)
["abbr"]=>
string(3) "CET"
}
NULL
NULL
int(3600)
Output for 8.0.0 - 8.0.30 , 8.1.6 - 8.1.31 Warning: Undefined variable $offset1 in /in/FGbtV on line 117
Warning: Undefined variable $offset2 in /in/FGbtV on line 117
array(5) {
["ts"]=>
int(4160077200)
["time"]=>
string(24) "2101-10-30T01:00:00+0000"
["offset"]=>
int(3600)
["isdst"]=>
bool(false)
["abbr"]=>
string(3) "CET"
}
NULL
NULL
int(3600)
Output for 8.1.0 - 8.1.5 array(5) {
["ts"]=>
int(4160077200)
["time"]=>
string(24) "2101-10-30T01:00:00+0000"
["offset"]=>
int(3600)
["isdst"]=>
bool(false)
["abbr"]=>
string(3) "CET"
}
int(7200)
int(3600)
int(7200)
Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.34 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Notice: Undefined variable: offset1 in /in/FGbtV on line 117
Notice: Undefined variable: offset2 in /in/FGbtV on line 117
array(5) {
["ts"]=>
int(4160077200)
["time"]=>
string(24) "2101-10-30T01:00:00+0000"
["offset"]=>
int(3600)
["isdst"]=>
bool(false)
["abbr"]=>
string(3) "CET"
}
NULL
NULL
int(3600)
Output for 5.2.0 - 5.2.17 Notice: Undefined variable: transitiontimestamp2 in /in/FGbtV on line 117
Notice: Undefined variable: offset1 in /in/FGbtV on line 117
Notice: Undefined variable: offset2 in /in/FGbtV on line 117
Notice: Undefined variable: offset4 in /in/FGbtV on line 117
NULL
NULL
NULL
NULL
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 Fatal error: Call to undefined function timezone_open() in /in/FGbtV on line 4
Process exited with code 255 . Output for 4.4.5 - 4.4.9 Fatal error: Call to undefined function: timezone_open() in /in/FGbtV on line 4
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.4 Fatal error: Call to undefined function: timezone_open() in /in/FGbtV on line 4
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Call to undefined function: timezone_open() in /in/FGbtV on line 4
preferences:dark mode live preview ace vim emacs key bindings
66.69 ms | 416 KiB | 5 Q