1
我正在使用谷歌方向API进行包括流量在内的两个地点之间的估计持续时间计算。我正在使用出发时间:2016年1月22日星期五时间:中午12点(IST)。根据谷歌API,如果我们需要的交通时间,那么我们需要包括出发时间的UTC和出发时间应该是当前时间或更大。见下面的链接Google方向API时区从IST转换为UTC
https://developers.google.com/maps/documentation/directions/intro?hl=en
现在我的问题是,我的发车时间为“周五22月-2016时间:下午12:00(北京时间)”(1453464000)时,我打算把它转换到UTC那么它将是“2016年1月22日星期五时间: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';
代码请提出解决方案。
是的印度从UTC前进5小时30分钟,所以每当我们将印度时间转换为UTC时,它总是会比印度小(我的意思是印度的过去时间),因为我会通过这个时间Google方向API时,它总是会显示错误,如“指定时间已过” –