Java Date ISO Parse parseDateISO(String date)

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

Description

parse Date ISO

License

Apache License

Declaration

public static Calendar parseDateISO(String date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {
    public static final DateFormat FORMAT_DATE_ISO = new SimpleDateFormat("yyyy-MM-dd");
    public static final DateFormat FORMAT_DATE_TIME = new SimpleDateFormat("dd/MM/yyyy HH:mm");

    public static Calendar parseDateISO(String date) {
        return parseDateTime(date, FORMAT_DATE_ISO);
    }//  w  ww  . jav  a2 s  . c om

    public static Calendar parseDateTime(String dateTime) {
        return parseDateTime(dateTime, FORMAT_DATE_TIME);
    }

    public static Calendar parseDateTime(String dateTime, DateFormat format) {
        Calendar resultado = GregorianCalendar.getInstance();
        try {
            resultado.setTime(format.parse(dateTime));
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
        return resultado;
    }
}

Related

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