Format TimeZone in Z (RFC 822) format like -8000. : TimeZone « Development Class « Java






Format TimeZone in Z (RFC 822) format like -8000.

   

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

  public static void main(String[] args) {
    Date date = new Date();

    
    SimpleDateFormat sdf = new SimpleDateFormat("Z");
    System.out.println("TimeZone in Z format : " + sdf.format(date));
  }
}
//TimeZone in Z format : -0800

   
    
    
  








Related examples in the same category

1.Format TimeZone in z (General time zone) format like EST.
2.Format TimeZone in zzzz format Eastern Standard Time.
3.Display Available Time Zones
4.Get all available timezones
5.Convert time between timezone
6.TimeZone.getTimeZone("America/New_York")
7.TimeZone.getTimeZone("Europe/Paris")
8.TimeZone.getTimeZone("Asia/Tokyo")
9.Converting Times Between Time Zones
10.Getting the Current Time in Another Time Zone
11.Using the Calendar Class to Display Current Time in Different Time Zones
12.Get current TimeZone using Java Calendar
13.Create a Calendar object with the local time zone and set the UTC from japanCal
14.Get the time in the local time zone
15.Timezone conversion routines
16.Convert the date to the given timezone