Java Date Parse dateFromISO8601(String iso)

Here you can find the source of dateFromISO8601(String iso)

Description

date From ISO

License

Open Source License

Declaration

public static Date dateFromISO8601(String iso) 

Method Source Code

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

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

public class Main {
    public static SimpleDateFormat tportResultFormat = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss.SSSZ");

    public static Date dateFromISO8601(String iso) {
        try {//from   w ww .  jav a2s  .c om
            String noColon = iso.substring(0, 26) + iso.substring(27);
            return tportResultFormat.parse(noColon);
        } catch (ParseException e) {
            throw new RuntimeException(
                    "Really unlikely, but it looks like "
                            + "travelport is not using ISO dates anymore! "
                            + e.getMessage());
        }
    }
}

Related

  1. convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime)
  2. convertUTCDateToLocal(String sDate, TimeZone timezone)
  3. convertXMLDate(String date)
  4. dateFromFilename(File file, Pattern fileNamePattern, DateFormat dateFormat)
  5. dateFromHourAndMinutes(final String pTime)
  6. dateFromISO8601(String time)
  7. dateFromISODate(String isoDate)
  8. dateFromString(final String value)
  9. dateFromString(String date)