有谁知道 TimezoneOffset 对 LuisPredictionOptions 做了什么?
Does anyone know what TimezoneOffset does on LuisPredictionOptions?
我正在向 LUIS 发送一个基于时间值的查询(例如 "what is the time 10 minutes from now" - 只是一个例子)。我希望时间回到本地时区,所以在 LuisPredictionOptions 对象 (C#) 上我设置了 TimezoneOffset(例如我将它设置为提前 2 小时或 120 分钟)。
在 Fiddler 中,我可以看到它在调用 LUIS 端点时正确添加了 "timezoneOffset=120.0"。
但是,时区返回为 UTC - 无论是否设置了 timezoneOffset,甚至设置了什么,时间总是返回 UTC,使用内置的 datetimeV2 实体。
有人知道 TimezoneOffset 属性 的用途吗?我只是使用不当吗?有没有其他方法可以从 LUIS 获取当地时间?
我正在尝试以下示例话语:"in 10 minutes".
当我这样做时,timex 是 UTC(例如 timex=2020-01-11T16:08:25)并且 "value" 返回相同的值,减去 "T",如下:value=2020-01-1116:08:25
如果 timex 是 UTC,我也许能理解,但可能 "value" 应该由 timezoneOffset 调整?
TimeZoneInfoclass的FindSystemTimeZoneById方法可用于根据系统时间确定正确的timezoneOffset。 C# 中的示例如下所示:
// Get CST zone id
TimeZoneInfo targetZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
// Get local machine's value of Now
DateTime utcDatetime = DateTime.UtcNow;
// Get Central Standard Time value of Now
DateTime cstDatetime = TimeZoneInfo.ConvertTimeFromUtc(utcDatetime, targetZone);
// Find timezoneOffset
int timezoneOffset = (int)((cstDatetime - utcDatetime).TotalMinutes);
您的 URL 中似乎有一个不正确的问号,就在 timezoneOffset 之前。
使用相同的查询,我能够获得预期的行为,其中返回值相差 10 分钟。
您使用的是哪个SDK?也许您正在使用 V3 Runtime SDK,它使用不使用 timeZoneOffset 而是使用 datetimeReference 的 V3 端点,并且需要改用 V2 Runtime SDK。
我正在向 LUIS 发送一个基于时间值的查询(例如 "what is the time 10 minutes from now" - 只是一个例子)。我希望时间回到本地时区,所以在 LuisPredictionOptions 对象 (C#) 上我设置了 TimezoneOffset(例如我将它设置为提前 2 小时或 120 分钟)。
在 Fiddler 中,我可以看到它在调用 LUIS 端点时正确添加了 "timezoneOffset=120.0"。
但是,时区返回为 UTC - 无论是否设置了 timezoneOffset,甚至设置了什么,时间总是返回 UTC,使用内置的 datetimeV2 实体。
有人知道 TimezoneOffset 属性 的用途吗?我只是使用不当吗?有没有其他方法可以从 LUIS 获取当地时间?
我正在尝试以下示例话语:"in 10 minutes".
当我这样做时,timex 是 UTC(例如 timex=2020-01-11T16:08:25)并且 "value" 返回相同的值,减去 "T",如下:value=2020-01-1116:08:25
如果 timex 是 UTC,我也许能理解,但可能 "value" 应该由 timezoneOffset 调整?
TimeZoneInfoclass的FindSystemTimeZoneById方法可用于根据系统时间确定正确的timezoneOffset。 C# 中的示例如下所示:
// Get CST zone id
TimeZoneInfo targetZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
// Get local machine's value of Now
DateTime utcDatetime = DateTime.UtcNow;
// Get Central Standard Time value of Now
DateTime cstDatetime = TimeZoneInfo.ConvertTimeFromUtc(utcDatetime, targetZone);
// Find timezoneOffset
int timezoneOffset = (int)((cstDatetime - utcDatetime).TotalMinutes);
您的 URL 中似乎有一个不正确的问号,就在 timezoneOffset 之前。
使用相同的查询,我能够获得预期的行为,其中返回值相差 10 分钟。
您使用的是哪个SDK?也许您正在使用 V3 Runtime SDK,它使用不使用 timeZoneOffset 而是使用 datetimeReference 的 V3 端点,并且需要改用 V2 Runtime SDK。