Hàm timezone_offset_get() của PHP
Ví dụ
Trả về phần bù múi giờ từ GMT:
<?php
$tz=timezone_open("Asia/Taipei");
$dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));
echo timezone_offset_get($tz,$dateTimeOslo);
?>
Hãy tự mình thử »Định nghĩa và cách sử dụng
timezone_offset_get() trả về chênh lệch múi giờ từ GMT.
Cú pháp
timezone_offset_get (object, datetime)
Giá trị tham số
Parameter | Description |
---|---|
object | Required. Specifies a DateTimeZone object returned by timezone_open() |
datetime | Required. Specifies a date/time to compute the offset from |
Chi tiết kỹ thuật
Giá trị trả về: | Trả về độ lệch múi giờ tính bằng giây nếu thành công. FALSE khi thất bại |
---|---|
Phiên bản PHP: | 5.2+ |
❮ Tham chiếu ngày/giờ PHP