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  .  co m
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. Create DateFormat to format date
Home » Java Tutorial » Date, Time, Calendar, TimeZone

Date

    Date class
    Date comparison
    Converting date value
    DateFormat class
    Format time
    DateFormat and Locale
    Convert String to Date

Calendar

    Calendar class
    Calendar date time getter
    Calendar set hour,minute,second
    Calendar calculation
    Calendar comparison
    Calendar properties
    GregorianCalendar

TimeZone

    TimeZone
    TimeZone ID and display name
    TimeZone daylight saving

DateFormat

    DateFormat class
    Format time
    DateFormat and Locale
    Convert String to Date
    SimpleDateFormat
    Parse date string into Date object
    SimpleDateFormat day format
    SimpleDateFormat Hour Time format
    SimpleDateFormat format minute
    SimpleDateFormat to format month
    SimpleDateFormat to format second value
    SimpleDateFormat to format TimeZone
    SimpleDateFormat to format year
    SimpleDateFormat to combine formatting flags