ms图表API。时区未更改响应

问题描述 投票:0回答:1

[首先,我正在使用Java Spring Web应用程序。

并且我想将时区设置为“东京标准时间”

但是,它对我不起作用。

下面是我的代码。

//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请求,他们总是返回(响应)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中更改。

我不知道是什么问题。我想念什么?

spring-mvc outlook retrofit azure-ad-graph-api
1个回答
0
投票

您的时间字符串2019-11-15T09:00:00Z中的字符'Z'表示这是UTC时间,因此图表API将忽略'Prefer'标头。

删除时间字符串中的'Z',它应该可以工作。

© www.soinside.com 2019 - 2024. All rights reserved.