Java examples for Date Time:SimpleDateFormat
Formatting TimeZone using SimpleDateFormat
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { Date date = new Date(); String strDateFormat = "zzz"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); System.out.println("TimeZone in z format : " + sdf.format(date)); strDateFormat = "zzzz"; sdf = new SimpleDateFormat(strDateFormat); System.out.println("TimeZone in zzzz format : " + sdf.format(date)); strDateFormat = "Z"; sdf = new SimpleDateFormat(strDateFormat); System.out.println("TimeZone in Z format : " + sdf.format(date)); }/*from ww w .j av a2 s . c o m*/ }