Home » Java programming language

Java SimpleTimeZone useDaylightTime() Method with Example

SimpleTimeZone Class useDaylightTime() method: Here, we are going to learn about the useDaylightTime() method of SimpleTimeZone Class with its syntax and example.
Submitted by Preeti Jain, on March 12, 2020

SimpleTimeZone Class useDaylightTime() method

  • useDaylightTime() method is available in java.util package.
  • useDaylightTime() method is used to check whether this SimpleTimeZone uses daylight saving time or not.
  • useDaylightTime() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
  • useDaylightTime() method does not throw an exception at the time of checking this object DST.

Syntax:

    public boolean useDaylightTime();

Parameter(s):

  • It does not accept any parameter.

Return value:

The return type of the method is boolean, it returns true when this SimpleTimeZone uses daylight saving time otherwise it returns false.

Example:

// Java program to demonstrate the example 
// of boolean useDaylightTime() method 
// of SimpleTimeZone

import java.util.*;

public class UseDaylightTimeOfSimpleTimeZone {
    public static void main(String args[]) {
        // Instantiates SimpleTimeZone object
        SimpleTimeZone s_tz = new SimpleTimeZone(360, "FRANCE");

        // By using useDaylightTime() method is
        // to check whether this SimpleTimeZone
        // use daylight saving time or not
        boolean status = s_tz.useDaylightTime();

        // Display status
        System.out.print("s_tz.useDaylightTime(): ");
        System.out.println(status);
    }
}

Output

s_tz.useDaylightTime(): false


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.