TimeZone daylight saving

In this chapter you will learn:

  1. Get daylight saving

Get daylight saving

  • int getDSTSavings()
    Returns the amount of time to be added to local standard time to get local wall clock time.
  • abstract boolean inDaylightTime(Date date)
    Queries if the given date is in daylight savings time in this time zone.
  • abstract boolean useDaylightTime()
    Queries if this time zone uses daylight savings time.
import java.util.Date;
import java.util.TimeZone;
//from   j  a  v  a  2  s . com
public class Main {

  public static void main(String[] args) {
    TimeZone tz = TimeZone.getTimeZone("America/New_York");

    System.out.println(tz.inDaylightTime(new Date()));
  }
}

The output:

Next chapter...

What you will learn in the next chapter:

  1. How to create Calendar class