Java Date GMT Format getNewGmtSimpleDateFormat(String format)

Here you can find the source of getNewGmtSimpleDateFormat(String format)

Description

get New Gmt Simple Date Format

License

Open Source License

Declaration

static public SimpleDateFormat getNewGmtSimpleDateFormat(String format) 

Method Source Code

//package com.java2s;
/*//from  w w  w  .j  a  v  a2  s . c o  m
     
Copyright IBM Corp. 2010, 2016
This file is part of Anomaly Detection Engine for Linux Logs (ADE).
    
ADE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
ADE 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 General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with ADE.  If not, see <http://www.gnu.org/licenses/>.
     
*/

import java.text.SimpleDateFormat;

import java.util.TimeZone;

public class Main {
    static public final TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT");

    static public SimpleDateFormat getNewGmtSimpleDateFormat(String format) {
        return getNewGmtSimpleDateFormat(format, true);
    }

    static public SimpleDateFormat getNewGmtSimpleDateFormat(String format, boolean lenient) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setTimeZone(GMT_TIMEZONE);
        sdf.setLenient(lenient);
        return sdf;
    }
}

Related

  1. formatGMT(Date date, String parttern)
  2. formatGmtDate(Date date)
  3. formatGMTDate(Date gmtTime, int offset)
  4. getDefaultID2GMT()
  5. getFormattedGMTDate(long timestamp)
  6. getStringBaseGMT(Date date, String timezone)
  7. getThreadLocalGMTDateFormat(final String format)
  8. getTimeAndDateAtGMT()
  9. getTzToGmt(String dateStr, String dateFormat, String beforeTimeZone, String afterTimeZone)