毫秒图 api。时区不会响应而改变
ms graph api. Timezone does not change in response
首先,我使用的是 Java Spring 网络应用程序。
我想将时区设置为 "Tokyo Standard Time"
但是,它对我不起作用。
下面是我的代码。
//Retrofit code
@Headers("Prefer: outlook.timezone=\"Tokyo Standard Time\"")
@POST("/v1.0/me/events")
Call<PagedResult<Event>> sendMessage(@Body Event event);
这是正文中的时区。
//Start timezone
DateTimeTimeZone Start_timezone = new DateTimeTimeZone();
Start_timezone.setTimeZone("Tokyo Standard Time");
...
如果我发送 POST 请求,他们总是 return(响应)UTC 时区。
...
"start":{"dateTime":"2019-11-15T09:00:00.0000000","timeZone":"UTC"}
...
这是我的请求日志,
Content-Type: application/json; charset=UTF-8
Content-Length: 380
Prefer: outlook.timezone="Tokyo Standard Time"
...
"start":{"dateTime":"2019-11-15T09:00:00Z","timeZone":"Tokyo Standard Time"},
...
POST 请求正常。但是,时区不会改变。
此外,Graph Explorer 中的时区发生了变化。
我不知道问题出在哪里。
我错过了什么?
您的时间字符串 2019-11-15T09:00:00Z
中的字符 'Z' 表示它是 UTC 时间,因此图表 API 将忽略 'Prefer' header。
删除时间字符串中的 'Z',它应该可以工作。
首先,我使用的是 Java Spring 网络应用程序。
我想将时区设置为 "Tokyo Standard Time"
但是,它对我不起作用。
下面是我的代码。
//Retrofit code
@Headers("Prefer: outlook.timezone=\"Tokyo Standard Time\"")
@POST("/v1.0/me/events")
Call<PagedResult<Event>> sendMessage(@Body Event event);
这是正文中的时区。
//Start timezone
DateTimeTimeZone Start_timezone = new DateTimeTimeZone();
Start_timezone.setTimeZone("Tokyo Standard Time");
...
如果我发送 POST 请求,他们总是 return(响应)UTC 时区。
...
"start":{"dateTime":"2019-11-15T09:00:00.0000000","timeZone":"UTC"}
...
这是我的请求日志,
Content-Type: application/json; charset=UTF-8
Content-Length: 380
Prefer: outlook.timezone="Tokyo Standard Time"
...
"start":{"dateTime":"2019-11-15T09:00:00Z","timeZone":"Tokyo Standard Time"},
...
POST 请求正常。但是,时区不会改变。
此外,Graph Explorer 中的时区发生了变化。
我不知道问题出在哪里。 我错过了什么?
您的时间字符串 2019-11-15T09:00:00Z
中的字符 'Z' 表示它是 UTC 时间,因此图表 API 将忽略 'Prefer' header。
删除时间字符串中的 'Z',它应该可以工作。