Sending a date and timezone from GAE server to GWT client

拟墨画扇 提交于 2019-11-30 09:44:11

I have a similar issue with v2.4.

I think Riley Lark is right.

TimeZone.createTimeZone("Asia/Tokyo") did not work in GWT 2.4

However, I found I could get the Tokyo zone by using the browser's default setting via:

Date d = new Date();
TimeZone timezone = TimeZone.createTimeZone(d.getTimezoneOffset());

That is really what Riley Lark is suggesting for you since europeLondon has "std_offset": 0...

TimeZone timezone = TimeZone.createTimeZone(0);

Have you tried, for example, TimeZone.createTimeZone("Europe/London");? At least in newer versions of GWT, this method accepts a whole bunch of names, evidently prepared "from CLDR and Olson time zone database[sic]". The documentation specifically references your use case: transferring timezone via json.

See the properties file - it seems like it has all of the standard names for timezones.

If that doesn't do it for you, you could transmit the offset of the timezone in minutes, and then create your timezone with TimeZone.createTimeZone(offsetInMinutes).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!