gpt4 book ai didi

c# - Google Maps.TimeZone.Query LatLng 返回不正确的时间偏移

转载 作者:太空宇宙 更新时间:2023-11-03 13:12:12 25 4
gpt4 key购买 nike

当我尝试使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com