Java TimeZone Format addDateFormatsToList(Locale locale, TimeZone timeZone, List formats)

Here you can find the source of addDateFormatsToList(Locale locale, TimeZone timeZone, List formats)

Description

add Date Formats To List

License

Open Source License

Declaration

static void addDateFormatsToList(Locale locale, TimeZone timeZone, List<DateFormat> formats) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.util.List;
import java.util.Locale;

import java.util.TimeZone;

public class Main {
    static void addDateFormatsToList(Locale locale, TimeZone timeZone, List<DateFormat> formats) {
        for (int dateStyle = DateFormat.FULL; dateStyle <= DateFormat.SHORT; dateStyle++) {
            DateFormat df = DateFormat.getDateInstance(dateStyle, locale);
            df.setTimeZone(timeZone);//from  w  ww.ja v  a 2s  .co  m
            formats.add(df);
        }
    }
}

Related

  1. createDateFormat(String format, TimeZone tz)
  2. createDateFormat(String pattern, TimeZone timeZone)
  3. createDateFormat(TimeZone timezone)
  4. createDateFormatsForLocaleAndTimeZone(Locale locale, TimeZone timeZone)