Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Datetime 在多个时区(特别是美国/加拿大)为用户指定一个时间_Datetime_User Interface_Time_Timezone - Fatal编程技术网

Datetime 在多个时区(特别是美国/加拿大)为用户指定一个时间

Datetime 在多个时区(特别是美国/加拿大)为用户指定一个时间,datetime,user-interface,time,timezone,Datetime,User Interface,Time,Timezone,我正在实现一个注册设施,它发送一个带有令牌的链接-令牌有效期为1小时。所以在电子邮件中,假设现在是14:20,我想说: 您必须在15:30之前单击此链接 这个网站的受众将在爱尔兰/英国、美国/加拿大,也许还有一些在欧洲-所以我想列出几个时区的到期时间,这些非技术人员会理解 这就是我想到的 Click by: Ireland/UK > 25 Apr 2018 13:59 CET (Berlin) > 25 Apr 2018 14:59 Pacific (Los Angeles) &

我正在实现一个注册设施,它发送一个带有令牌的链接-令牌有效期为1小时。所以在电子邮件中,假设现在是14:20,我想说:

您必须在15:30之前单击此链接

这个网站的受众将在爱尔兰/英国、美国/加拿大,也许还有一些在欧洲-所以我想列出几个时区的到期时间,这些非技术人员会理解

这就是我想到的

Click by:

Ireland/UK > 25 Apr 2018 13:59
CET (Berlin) > 25 Apr 2018 14:59

Pacific (Los Angeles) > 25 Apr 2018 05:59

Mountain (Denver) > 25 Apr 2018 06:59

Central (Chicago) > 25 Apr 2018 07:59

Eastern (New York) > 25 Apr 2018 08:59
现在,我知道丹佛目前是冬季的MDT和MST,但在爱尔兰,我们现在是IST UTC+1或冬季/秋季的GMT-但如果你随机问一个人我们在哪个时区,最多你会得到全年的GMT作为回答。因此,我把那里的时间列为一座普通的“山”,并给出了一个样本城市

这种方法如何适用于美国/加拿大的人

我的代码在下面,这是一个

在我看来是正确的

一定要测试它的“亚洲/加尔各答”。这是一个很好的测试,因为它的时区偏移是半小时

《美国/凤凰城》也是如此,因为它们全年都保持标准时间

通常,像这样的应用程序要求每个用户在登录时提供时区名称。但许多用户并不介意


在美国,当我们想要以一种不必在夏季和冬季之间改变的方式指定时区时,我们称之为东部时间、中部时间、山区时间、太平洋时间以及夏威夷和阿拉斯加时间。加拿大人也有大西洋时间“美国/哈利法克斯”。在亚利桑那州的“美国/凤凰城”他们说“亚利桑那时间”

谢谢。但我更感兴趣的是UI方面的事情,比如北美人对时区有多熟悉,我的文本是否清晰?你能澄清你的问题吗:你只是想知道哪些时区应该在你的列表中涵盖美国和加拿大吗?还是你也想要其他人?请具体说明。谢谢。请看我在O Jones回答下面的评论-美国客户需要这个,东海岸的客户更可能需要。试图用尽可能简单的语言表达链接到期时间而不使事情复杂化,如果可能的话,可以说是DST或不是DST。我可以继续谈论美国印第安纳州的所有时区,那里的立法机构曾经接近通过一项法律,将π的值确定为22/7。但我会饶了你的。刚刚试过印度,效果不错。事实上,我确实有凤凰山的时间,并认为我有一个错误是一样的洛杉矶。进一步看,他们没有DST。啊,我们都知道馅饼是三分一片的!我用建议文本更新了live链接。除非你认为我需要,否则我会把它放在4个时区,因为事实上,这个网站是关于爱尔兰产品的,我会说离东海岸越远,兴趣就越少。在圣帕特里克节,美国的每个人都是爱尔兰人。但那一天总是在夏令时。
<?php
$exipry = 60*60 + time();

$now_obj       = new DateTime(date("Y-m-d H:i:s", $exipry));

$now_obj->setTimezone(new DateTimeZone('Europe/Dublin'));
$now_hour_from_IRELAND_datetime = $now_obj->format('d M Y H:i');


$now_obj->setTimezone(new DateTimeZone('Europe/Berlin'));
$now_hour_from_CET_datetime = $now_obj->format('d M Y H:i');

$now_obj->setTimezone(new DateTimeZone('America/Los_Angeles'));
$now_hour_from_pacific_datetime = $now_obj->format('d M Y H:i');

$now_obj->setTimezone(new DateTimeZone('America/Denver'));
$now_hour_from_mountain_datetime = $now_obj->format('d M Y H:i');

$now_obj->setTimezone(new DateTimeZone('America/Chicago'));
$now_hour_from_central_datetime = $now_obj->format('d M Y H:i');

$now_obj->setTimezone(new DateTimeZone('America/New_York'));
$now_hour_from_eastern_datetime = $now_obj->format('d M Y H:i');

print("<h1>1 hour from now is:</h1>");
print("Ireland/UK  > $now_hour_from_IRELAND_datetime<p>");
print("CET (Berlin) > $now_hour_from_CET_datetime<p>");
print("Pacific (Los Angeles) > $now_hour_from_pacific_datetime<p>");
print("Mountain (Denver) > $now_hour_from_mountain_datetime<p>");
print("Central (Chicago) > $now_hour_from_central_datetime<p>");
print("Eastern (New York) > $now_hour_from_eastern_datetime<p>");

?>