Java Parse Date Pattern YYYY parseAsDateTime(String date)

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

Description

parse As Date Time

License

Apache License

Declaration

public static DateTime parseAsDateTime(String date) 

Method Source Code


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

import org.joda.time.DateTime;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String DATE_FORMAT = "yyyy-MM-dd";

    public static DateTime parseAsDateTime(String date) {
        return new DateTime(parseDate(date));
    }//from w  w  w . j  a v  a 2 s.c  o  m

    public static Date parseDate(String date) {
        return parseDate(date, DATE_FORMAT);
    }

    public static Date parseDate(String dateString, String dateFormat) {
        try {
            return new SimpleDateFormat(dateFormat).parse(dateString);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. parse2DateString(String date)
  2. parse_default(String time)
  3. parseApplePurchaseDate(String dateStr)
  4. parseArgument(String textDate)
  5. parseAscTime(String date)
  6. parseAtomDate(String date_str)
  7. parseBingDate(String dateString)
  8. parseBitcoin(String calendarString)
  9. parseCalendar2String(Calendar calendar)