Java Date ISO Parse parseDateISO(String value)

Here you can find the source of parseDateISO(String value)

Description

parse Date ISO

License

Open Source License

Declaration

public synchronized static Date parseDateISO(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static final String ISO_FORMAT_SECONDS = "yyyy-MM-dd'T'HH:mm:ss'Z'";
    private static final SimpleDateFormat isoFormat = new SimpleDateFormat();

    public synchronized static Date parseDateISO(String value) {
        if (value == null) {
            return null;
        }/*w w  w .j av  a 2  s.  co m*/
        isoFormat.applyPattern(ISO_FORMAT_SECONDS);
        try {
            return isoFormat.parse(value);
        } catch (ParseException pe) {
            // skip
        }
        isoFormat.applyPattern("yyyy-MM-dd");
        try {
            return isoFormat.parse(value);
        } catch (ParseException pe) {
            return null;
        }
    }
}

Related

  1. isValidISO8601(String time)
  2. normalizeToISO8601(String sDate, TimeZone tz)
  3. parseAwsFlavouredISO8601Date(String dateString)
  4. parseDate(String iso8061StrDateTime)
  5. parseDateISO(String date)
  6. parseDateISO(String value)
  7. parseDateTime(String iso8061StrDateTime)
  8. parseFromIso8601(String s)
  9. parseISO(String aIsoString)