Open In App

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:



Exception: The function does not throws any exception.

Program below demonstrates the above mentioned function:




// 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());
    }
}

Output:
Day light time is = false




// 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());
    }
}

Output:
Day light time is = false

Article Tags :