Hàm date_offset_get () trong PHP
Thí dụ
Trả lại chênh lệch múi giờ cho Oslo (ở Na Uy, Châu Âu) tính bằng giây từ UTC, mùa đông và mùa hè:
<?php
$winter=date_create("2013-12-31",timezone_open("Europe/Oslo"));
$summer=date_create("2013-06-30",timezone_open("Europe/Oslo"));
echo date_offset_get($winter) . " seconds.<br>";
echo date_offset_get($summer) . " seconds.";
?>
Định nghĩa và Cách sử dụng
Hàm date_offset_get () trả về độ lệch múi giờ.
Cú pháp
date_offset_get(object)
Giá trị tham số
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
Chi tiết kỹ thuật
Giá trị trả lại: | Trả về độ lệch múi giờ tính bằng giây từ UTC 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