如何在 PHP 中获取不同时区的当前时间? [英] How to get different timezones' current time in PHP?

查看:45
本文介绍了如何在 PHP 中获取不同时区的当前时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不幸的是,我没有使用 PHP 5.在 date 函数的文档中,它有一个时区部分这让您可以指定与 GMT 大部头的差异.您如何使用它来获取指定时区的当前/本地时间,并使用夏令时?

Unfortunately I'm not using PHP 5. On the documentation of the date function it has a timezone section which lets you specify the difference from the GMT tome. How can you use that to get the current/local time in a specified timezone, and does it with with daylights savings?

推荐答案

您可以使用 PEAR 日期包 http://pear.php.net/package/Date

You can convert times to different timezones by using the PEAR Date package http://pear.php.net/package/Date

这里的例子 http://pear.php.net/manual/en/package.datetime.date.examples.php

这篇关于如何在 PHP 中获取不同时区的当前时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆