EWS托管API - 如何设置开始时区? [英] EWS Managed API-How do I set the start time zone?

查看:223
本文介绍了EWS托管API - 如何设置开始时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有java和Exchange 2010的EWS Managed API 1.1.3。 我住在美国太平洋时区。 我每次安排会议时都试图将我的时间转换为太平洋时间,减去我给它8小时的时间! 我想要
它只是把我的时间花在太平洋时间而不是触摸它。 

I am using EWS Managed API 1.1.3 with java and exchange 2010.  I live in the United States Pacific Time Zone.  Every time I schedule a meeting it tries to convert my time to pacific time, subtracting the time I give it by 8 hours!  I want it just to take my time as pacific time and not touch it. 

首先我尝试在服务对象的构造函数中设置时区:

First I tried to set the time zone in the constructor of my service object:

s =新的ExchangeService(ExchangeVersion.Exchange2010,TimeZone.getTimeZone(" America / Los_Angeles"));

s = new ExchangeService(ExchangeVersion.Exchange2010, TimeZone.getTimeZone("America/Los_Angeles"));

这没有做任何事情某种原因。

This didn't do anything for some reason.

然后我尝试设置开始时区:

Then I tried setting the start time zone:

mtg.setStartTimeZone(new TimeZoneDefinition(){{setId(" America /) Los_Angeles");}});

mtg.setStartTimeZone(new TimeZoneDefinition(){{setId("America/Los_Angeles");}});

我收到了一条错误消息,指出无法识别的时区。

And I got an error saying unrecognized time zone.

有人可以帮我解决这个问题吗? 这很紧急!!!

Can somebody please help me with this?  It's urgent!!!

推荐答案

我想通了。 在设置任何日期或时间之前,我需要添加以下行:

I figured it out.  I need to add the following line before I set any dates or times:

TimeZone.setDefault(TimeZone.getTimeZone(" UTC"));

TimeZone.setDefault(TimeZone.getTimeZone("UTC"));


这篇关于EWS托管API - 如何设置开始时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆