当我尝试使用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()});
这似乎已经解决了问题。