如何将PST转换为GMT时间在PHP? [英] How to Convert PST to GMT time in php?

查看:113
本文介绍了如何将PST转换为GMT时间在PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将PST转换为GMT。

I would like convert PST to GMT.

例如:

PST:22: 00需要转换为GMT。我必须考虑关于DAY LIGHT SAVING TIME月。

PST : 22:00 need to convert in to GMT. I have to consider about DAY LIGHT SAVING TIME month also.

我该怎么做?

推荐答案

使用PHP的内置DateTime类...



使用 DateTime 具有内置功能的对象:

Use PHP's built-in DateTime class...

Use DateTime objects which have this functionality built in:

$date = new DateTime('2013-08-06 15:00:00', new DateTimeZone('America/Los_Angeles'));
echo "The time in Los Angeles is " . $date->format('Y-m-d H:i:s') . "<br>";
$date->setTimezone(new DateTimeZone('Europe/London'));
echo "The time in London is " . $date->format('Y-m-d H:i:s') . "<br>";

示例代码< a>)(完整文档

这篇关于如何将PST转换为GMT时间在PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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