Java Date Format Pattern getFormatters()

Here you can find the source of getFormatters()

Description

_more_

License

Open Source License

Return

_more_

Declaration

public static SimpleDateFormat[] getFormatters() 

Method Source Code

//package com.java2s;
/*/* www .ja  va2 s .c  om*/
 * Copyright 1997-2010 Unidata Program Center/University Corporation for
 * Atmospheric Research, P.O. Box 3000, Boulder, CO 80307,
 * support@unidata.ucar.edu.
 * 
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 */

import java.text.SimpleDateFormat;

public class Main {
    /** A set of common date formats */
    private static final String[] formats = { "yyyy-MM-dd'T'HH:mm:ss Z",
            "yyyyMMdd'T'HHmmss Z", "yyyy/MM/dd HH:mm:ss Z",
            "yyyy-MM-dd HH:mm:ss Z", "EEE MMM dd HH:mm:ss Z yyyy",
            "yyyy-MM-dd'T'HH:mm:ss", "yyyyMMdd'T'HHmmss",
            "yyyy-MM-dd'T'HH:mm Z", "yyyyMMdd'T'HHmm Z",
            "yyyy-MM-dd'T'HH:mm", "yyyyMMdd'T'HHmm", "yyyy/MM/dd HH:mm:ss",
            "yyyy-MM-dd HH:mm:ss", "yyyy/MM/dd HH:mm Z",
            "yyyy-MM-dd HH:mm Z", "yyyy/MM/dd HH:mm", "yyyy-MM-dd HH:mm",
            "yyyy-MM-dd", "yyyy/MM/dd", "yyyy-MM", "yyyy/MM", "yyyyMMdd",
            "yyyyMM", "yyyy" };
    /** The SimpleDateFormat objects we make from the above formats */
    private static SimpleDateFormat[] sdfs;

    /**
     * _more_
     *
     * @return _more_
     */
    public static SimpleDateFormat[] getFormatters() {
        if (sdfs == null) {
            SimpleDateFormat[] tmp = new SimpleDateFormat[formats.length];
            for (int i = 0; i < formats.length; i++) {
                tmp[i] = new SimpleDateFormat(formats[i]);
            }
            sdfs = tmp;
        }
        return sdfs;
    }
}

Related

  1. getFormattedValue(Object customFieldValue)
  2. getFormatter()
  3. getFormatter()
  4. getFormatter(final String pattern)
  5. getFormatter(String pattern)
  6. getFormatToSecsForFilename()
  7. getHeaderFormat()
  8. getLenientFormat(String format)
  9. getMM()