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 appreciated.
Asked
Active
Viewed 1,150 times
2 Answers
3
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.

ring bearer
- 20,383
- 7
- 59
- 72
-
I have a user timezone. I want to know how do I properly create date for display given timezone. How can I accomplish this? – Michael Sep 29 '11 at 16:25
-
see if [this](http://stackoverflow.com/questions/6841878/how-to-get-the-difference-without-timezones-between-two-times) helps - I will try to create an example if time permits. – ring bearer Sep 29 '11 at 16:35
0
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)
.

Vala
- 5,628
- 1
- 29
- 55