Java Parse Date Pattern YYYY parseXsdDate(final Date date)

Here you can find the source of parseXsdDate(final Date date)

Description

parse Xsd Date

License

Open Source License

Declaration

public static String parseXsdDate(final Date date) 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ssZ";

    public static String parseXsdDate(final Date date) {

        String temp = new SimpleDateFormat(DATE_FORMAT_STRING).format(date);

        return temp.substring(0, temp.length() - 2) + ":" + temp.substring(temp.length() - 2, temp.length());
    }/*  ww  w .jav a2 s  .  com*/

    public static Date parseXsdDate(final String XsdDate) throws ParseException {

        String temp = XsdDate.substring(0, XsdDate.length() - 3)
                + XsdDate.substring(XsdDate.length() - 2, XsdDate.length());

        return new SimpleDateFormat(DATE_FORMAT_STRING).parse(temp);
    }
}

Related

  1. parseW3CDateRobust(String dateString)
  2. parseW3CDateTime(String date)
  3. parseW3CDateTime(String sDate, Locale locale)
  4. parseWsDate(String date)
  5. parseXEP0082Date(String dateString)
  6. parseXsdDateTime(String date)
  7. parseYmd(String date)
  8. parseYmd(String s)
  9. parseYmdDate(String dateString)