Daylight detection fails in Java 1.1.8

From: work (raja_embedded_at_yahoo.com)
Date: 05/06/04


Date: Thu, 6 May 2004 11:26:37 +0530

Hi,

When I execute this following program in a windows PC with timezone is set
to GMT + 0 ( London) with automatic adjust for daylight saving enabled, I
get different results for java version 1.1.8 and 1.4.3.
In version 1.1.8 , the useDaylightTime() returns false which is wrong. In
version 1.4.3 , it returns true which is correct.
Similarly the getDisplayName() is not working in 1.1.8 but works in 1.4.3.
Could any body help me in how to achieve correct result for
daylightdetection for this timezone using version 1.1.8.

Here is the sample program.

import java.util.*;
public class timezone{
         public static void main(String[] args) {

                    TimeZone tzone = TimeZone.getDefault();
                    //String tzn = tzone.getDisplayName(); // Not working
in 1.1.8
                    //System.out.println(tzn);
                    if (tzone.useDaylightTime())
                         System.out.println("Daylight time present");
                    else
                         System.out.println("Daylight time absent");
          }
}

Thanks/Regards,
Work.



Relevant Pages

  • Re: which file control TIME Zone?
    ... We also have SUN Solaris servers, ... it and will execute cron jobs. ... of the timezone selected during install ...
    (RedHat)
  • Re: How to get the number of records of last 24 hour?
    ... viewing records of a person in a different timezone. ... Roedy Green Canadian Mind Products ... Because this program will execute on a ... single Server side, I don't think the the different timezone will ...
    (comp.lang.java.programmer)
  • Re: Daylight saving come up soon
    ... All you need do is ensure the timezone ... Windows has managed to handle DST without any problems since, IIRC, 95. ... University of Leicester, Leicester, LE1 7RH, UK ...
    (comp.lang.java.programmer)
  • Re: Linux
    ... timezone and hemisphere etc) ... Windows "Time Zone Editor" than with regedit. ... of minutes to apply at DST ... and running zic on them to format them ...
    (rec.crafts.metalworking)
  • Re: How to switch my timezone configure
    ... I am guessing your BIOS clock is set to a US timezone so is 8 hours ... Windows time to local wall-clock time or UTC. ...
    (Debian-User)