SimpleTimeZone useDaylightTime() method in Java

The useDaylightTime() method of SimpleTimeZone class is used as a query if this time zone uses daylight saving time.

Syntax:

public boolean useDaylightTime()

Parameters: The function does not accepts any parameter.



Return Value: The method gives either of the two return value:

  • ‘true’ if this time zone uses daylight saving time
  • ‘false’ if this time zone does not uses daylight saving time

Exception: The function does not throws any exception.

Program below demonstrates the above mentioned function:

filter_none

edit
close

play_arrow

link
brightness_4
code

// program to demonstrate the
// function java.util.SimpleTimeZone.useDaylightTime()
import java.util.*;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // create simple time zone object
        SimpleTimeZone obj
            = new SimpleTimeZone(700, "US");
  
        // checking day light time
        // and printing the result
        System.out.println("Day light time is = "
                           + obj.useDaylightTime());
    }
}

chevron_right


Output:

Day light time is = false
filter_none

edit
close

play_arrow

link
brightness_4
code

// program to demonstrate the
// function java.util.SimpleTimeZone.useDaylightTime()
import java.util.*;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // create simple time zone object
        SimpleTimeZone obj
            = new SimpleTimeZone(820, "India");
  
        // checking day light time
        // and printing the result
        System.out.println("Day light time is = "
                           + obj.useDaylightTime());
    }
}

chevron_right


Output:

Day light time is = false


My Personal Notes arrow_drop_up

Contented with little yet wishing for more

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.