6 Replies Latest reply on May 4, 2008 7:03 AM by darrylburke

    some problems related to java timezone

      Hi all,

      I am writing a web application which allow user to select their timezone during their login. So that's mean whenever the time the user see is converted to the timezone that they have specified during login.

      For example, the user selected timezone is Amsterdam(GMT+1:00). However, while i try to display the user last login date, the date has been converted based on the timezone of the webserver.

      take an example ..... user last login date is 23 March 2006 15:00 (GTM+1.00), in my DB, i have converted the date to UTC time.

      While i redisplay the date, it have been converted to 23 March 2006 22:00 (GMT+8:00) .... the timezone of my webserver is GMT +8

      Here is the code which i try to achieve the task i mention above
      long loginT = getLastLoginDate(); //In DB i store the last login date as  long  
                                                                       //which has converted to UTC
      TimeZone amsTZ = TimeZone.getTimeZone("Europe/Amsterdam");
                Calendar c = Calendar.getInstance();
      Could i know how to resolve the above problem which i can display the date correctly (eg the user will see 23 March 2006 15:00 (GTM+1.00) instead of 23 March 2006 22:00 (GTM+8.00))?

      Thanks for your help