Компенсация для сервера и пользователя для возврата локального времени
В редакторе
Компенсация для сервера и пользователя для возврата локального времени
Brain_Script
1952
2019-07-12 11:36:21
/*
$zone should reflect the GMT offset (e.g. -5)
$dst should be a 1 if the target time should be offset
for daylight savings time. It defaults to 0 (no dst)
If no value is given for $time, the function will use the
current time. Otherwise, it accepts Unix Epoch timestamps
*/
function makeTime($zone=0,$dst=0,$time=0) {
if ( $time === 0 ) {
$time = time();
}
$time -= date("Z",$time);
$time += $zone*60*60;
if ( $dst > 0 ) {
$time += 60*60;
}
return $time;
}
Войдите для добавления комментария.