Java Utililty Methods Parse Date Pattern YYYY

List of utility methods to do Parse Date Pattern YYYY

Description

The list of methods to do Parse Date Pattern YYYY are organized into topic(s).

Method

DateparseW3CDateRobust(String dateString)
parse WC Date Robust
try {
    return parseW3CDate(dateString);
} catch (ParseException e) {
    return parseW3CDateWithFractionalSeconds(dateString);
DateparseW3CDateTime(String date)
parse WC Date Time
int tIndex = date.indexOf("T");
if (tIndex > -1) {
    if (date.endsWith("Z")) {
        date = date.substring(0, date.length() - 1) + "+00:00";
    int tzdIndex = date.indexOf("+", tIndex);
    if (tzdIndex == -1) {
        tzdIndex = date.indexOf("-", tIndex);
...
DateparseW3CDateTime(String sDate, Locale locale)
parse WC Date Time
int tIndex = sDate.indexOf("T");
if (tIndex > -1) {
    if (sDate.endsWith("Z")) {
        sDate = sDate.substring(0, sDate.length() - 1) + "+00:00";
    int tzdIndex = sDate.indexOf("+", tIndex);
    if (tzdIndex == -1) {
        tzdIndex = sDate.indexOf("-", tIndex);
...
DateparseWsDate(String date)
parse Ws Date
return parseDate(date, WS_DATE_FORMAT);
DateparseXEP0082Date(String dateString)
Parses the given date string in the XEP-0082 - XMPP Date and Time Profiles format.
synchronized (XEP_0082_UTC_FORMAT) {
    return XEP_0082_UTC_FORMAT.parse(dateString);
StringparseXsdDate(final Date date)
parse Xsd Date
String temp = new SimpleDateFormat(DATE_FORMAT_STRING).format(date);
return temp.substring(0, temp.length() - 2) + ":" + temp.substring(temp.length() - 2, temp.length());
DateparseXsdDateTime(String date)
Parses a String that is formatted according to the xsd:dateTime data type and returns it as a Date
String newDate = date.trim();
if (newDate.endsWith("Z")) {
    newDate = newDate.substring(0, newDate.length() - 1) + "+0000";
} else {
    int colonPos = newDate.lastIndexOf(":");
    newDate = newDate.substring(0, colonPos) + newDate.substring(colonPos + 1, newDate.length());
return XSD_DATE_TIME_FORMAT.parse(newDate);
...
DateparseYmd(String date)
parse Ymd
return parseDate(date, "yyyy-MM-dd");
DateparseYmd(String s)
Utility method to parse a date in the given format
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try {
    return df.parse(s);
} catch (Exception e) {
    throw new RuntimeException("Cannot parse " + s + " into a date using ymd format");
DateparseYmdDate(String dateString)
parse Ymd Date
if (dateString == null) {
    return null;
Date date;
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
    date = fmt.parse(dateString);
} catch (ParseException e) {
...