谷歌方向 API 时区从 IST 转换为 UTC


Google direction API timezone conversion from IST to UTC

我正在使用谷歌方向API来计算两个地方(包括交通)之间的估计持续时间。我正在使用出发时间:星期五22-一月-2016时间:12:00 PM(IST)。根据谷歌API,如果我们需要交通时间,那么我们需要在UTC中包含出发时间,出发时间应该是当前时间或更大时间。见下面的链接

https://developers.google.com/maps/documentation/directions/intro?hl=en

现在我的问题是我的出发时间是"星期五22-一月-2016时间:12:00 PM(IST)"(1453464000)当我要将其转换为UTC时,它将是"星期五22-一月-2016时间:6:30 AM"(1453444200)。

现在,当我在谷歌方向API调用中传递这个时间时,它会显示错误:

[error_message] => departure_time is in the past. Traffic information is only available for future and current times. This is because this time has been passed in IST.

这是因为在这种情况下,UTC 小于 IST。现在我该如何管理呢?

请参阅下面的代码

$start = 'Vijay Nagar, Indore, Madhya Pradesh, India';
$finish = 'Regal Cir, New Agarwal Nagar, Indore, Madhya Pradesh, India'; 
$url = 'https://maps.googleapis.com/maps/api/directions/xml?origin=' .$start . '&destination=' . $finish . '&sensor=false&departure_time=1453533717&mode=driving&traffic_model=pessimistic&key=AIzaSyC7h7m5bRs-BZwk0XTXEQTB74dZujeLzZs';

请提出任何解决方案。

您的时间戳已关闭。

1453464000  ==  2016-01-22 12:00:00 UTC  ==  2016-01-22 17:30:00 India
1453444200  ==  2016-01-22 06:30:00 UTC  ==  2016-01-22 12:00:00 India

对于印度时间 06:30,这将是:

2016-01-22 06:30:00 India  ==  2016-01-22 01:00:00 UTC  ==  1453424400

印度比 UTC 5 小时 30 分钟. 此外,每当您以数字形式表示时间戳时,几乎总是基于 UTC