Hàm timezone_offset_get () trong PHP
Thí dụ
Trả lại chênh lệch 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);
?>
Định nghĩa và Cách sử dụng
Timezone_offset_get () trả về độ lệch múi giờ so với 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ả lại: | Trả về độ lệch múi giờ tính bằng giây khi thành công. FALSE khi thất bại |
---|---|
Phiên bản PHP: | 5,2+ |
❮ Tham chiếu ngày / giờ PHP