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:
import java.util.*;
public class GFG {
public static void main(String[] args)
{
SimpleTimeZone obj
= new SimpleTimeZone( 700 , "US" );
System.out.println( "Day light time is = "
+ obj.useDaylightTime());
}
}
|
Output:
Day light time is = false
import java.util.*;
public class GFG {
public static void main(String[] args)
{
SimpleTimeZone obj
= new SimpleTimeZone( 820 , "India" );
System.out.println( "Day light time is = "
+ obj.useDaylightTime());
}
}
|
Output:
Day light time is = false
Last Updated :
03 Jan, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...