当我尝试使用 GoogleMaps.TimeZone.Query 获取与阿姆斯特丹的时间偏移时,它说它提前 19 分钟而不是 1 小时。为什么会这样?有什么想法吗?
这是响应:
Offset: 0.0
RawOffSet: 1172.0
Status: OK
StatusStr: "OK"
TimeZoneId: "Europe/Amsterdam"
TimeZoneName: "GMT+00:19:32"
下面是我的代码:
var geocodeRequest = new GeocodingRequest()
{
Address = address
};
var geocodeResponse = GoogleMaps.Geocode.Query(geocodeRequest);
var responseResult = geocodeResponse.Results.FirstOrDefault();
if (responseResult != null)
{
var timezoneResult = GoogleMaps.TimeZone.Query(
new TimeZoneRequest
{
Sensor = false,
Language = user.UserProfile.Culture,
Location = responseResult.Geometry.Location
});
}
最佳答案
添加了另一个称为时间戳的参数,现在是世界时间
var timezoneResult = GoogleMaps.TimeZone.Query(new TimeZoneRequest{Sensor =false, Language = user.UserProfile.Culture, Location = responseResult.Geometry.Location,TimeStamp = DateTime.Now.ToUniversalTime()});
这似乎解决了问题。
关于c# - Google Maps.TimeZone.Query LatLng 返回不正确的时间偏移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28051367/