Java Date Format Check checkDateFormat()

Here you can find the source of checkDateFormat()

Description

check Date Format

License

Open Source License

Declaration

protected synchronized static void checkDateFormat() 

Method Source Code

//package com.java2s;
/*//from w w w  . j  a  v a  2s .  com
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    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. 
 */

import java.text.*;
import java.util.*;

public class Main {
    protected static SimpleDateFormat _dateFormat;
    protected static SimpleDateFormat _longTimeFormat;
    protected static SimpleDateFormat _shortTimeFormat;
    protected static SimpleDateFormat _fullFormat;
    protected final static String DATE_FORMAT_DEFN = "dd/MMM/yyyy";
    protected final static String LONG_TIME_FORMAT_DEFN = "HH:mm:ss";
    protected final static String SHORT_TIME_FORMAT_DEFN = "HH:mm";

    protected synchronized static void checkDateFormat() {
        if (_dateFormat == null) {
            _dateFormat = new SimpleDateFormat(DATE_FORMAT_DEFN);
            _dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
            _longTimeFormat = new SimpleDateFormat(LONG_TIME_FORMAT_DEFN);
            _longTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
            _shortTimeFormat = new SimpleDateFormat(SHORT_TIME_FORMAT_DEFN);
            _shortTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
            _fullFormat = new SimpleDateFormat(DATE_FORMAT_DEFN + "Z"
                    + LONG_TIME_FORMAT_DEFN);
            _fullFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
        }
    }
}

Related

  1. checkDate(String begingDate, String endDate)
  2. checkDate(String deadline)
  3. checkDateBetween(String time)
  4. checkDateByMask(String sDateValue, String sDateFormat)
  5. checkDateFormat()
  6. checkDateFormat(String pattern)
  7. checkDateFormat(String strTime, String pattern)
  8. checkDateFormatAndValite(String strDateTime, String format)
  9. checkDateInToday(Date date)