Java DateFormat.getTimeZone()

Syntax

DateFormat.getTimeZone() has the following syntax.

public TimeZone getTimeZone()

Example

In the following code shows how to use DateFormat.getTimeZone() method.


import java.text.DateFormat;
import java.util.Date;
/*from w w  w.  j  a  v  a2 s  .c  o  m*/
public class Main {
  public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();
    
    
    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getTimeZone());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat