开发者

Java. Creating a date according to user timezone in web-application

I have a Java web-application. In some places there is showing of dates. I want to display the date according to user timezone. How do I create a date for the show if I know the timezone the user? I use the class Date. Any help would be greatly appr开发者_如何学JAVAeciated.


There is no standard way to do this. On client side, you may capture time using Java script and send that information to the server. On server side, you can covert the time to Coordinated Universal Time.


Use GregorianCalendar rather than Date when you have any requirements besides basic display. You can create one for the current time by time-zone using new GregorianCalendar(TimeZone).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜