Java Date Parse dateFromISODate(String isoDate)

Here you can find the source of dateFromISODate(String isoDate)

Description

date From ISO Date

License

Open Source License

Declaration

public static Date dateFromISODate(String isoDate) 

Method Source Code

//package com.java2s;
/**/*from  w  ww .  j  av  a2  s.  c om*/
 * Copyright (c) 2010-2016, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

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

public class Main {
    public static Date dateFromISODate(String isoDate) {
        TimeZone tz = TimeZone.getTimeZone("UTC");
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss.S'Z'");
        dateFormat.setTimeZone(tz);
        try {
            return dateFormat.parse(isoDate);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. convertXMLDate(String date)
  2. dateFromFilename(File file, Pattern fileNamePattern, DateFormat dateFormat)
  3. dateFromHourAndMinutes(final String pTime)
  4. dateFromISO8601(String iso)
  5. dateFromISO8601(String time)
  6. dateFromString(final String value)
  7. dateFromString(String date)
  8. dateFromString(String date, String pattern)
  9. dateFromString(String dateString)