Java Date Parse getDateFromISO8601(String iso8601Date)

Here you can find the source of getDateFromISO8601(String iso8601Date)

Description

get Date From ISO

License

Open Source License

Declaration

public static Date getDateFromISO8601(String iso8601Date) 

Method Source Code

//package com.java2s;
/*/*from  w w w .ja v a2  s  . co  m*/
 * KivaUtil.java: The Kiva Util Object
 * 
 * Copyright (C) 2009 prashsoft.com
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation:
 * http://www.gnu.org/licenses/gpl-2.0.html
 * 
 * This program 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 version 2 for more details:
 * http://www.gnu.org/licenses/gpl-2.0.html
 * 
 * You should have received a copy of the GNU General Public License
 * version 2 along with this program; if not, write to the
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA. 
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";

    public static Date getDateFromISO8601(String iso8601Date) {
        SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_DATE_FORMAT);
        try {
            return sdf.parse(iso8601Date);
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. getDateFromFormattedDate(String dateStr, String format)
  2. getDateFromFormattedTimeStamp( String formattedTimeStamp)
  3. getDateFromIRODSValue(final String irodsValue)
  4. getDateFromISO8601(Object iso8601)
  5. getDateFromISO8601(String dateString)
  6. getDateFromIsoString(String dateString)
  7. getDateFromISOString(String iso)
  8. getDateFromOffset(Date prevDate, int offset)
  9. getDateFromOriDateStr(String strDate)