Java Utililty Methods Parse Date

List of utility methods to do Parse Date

Description

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

Method

DateparseDate(@Nonnull final String sFormat, @Nonnull final String sValue)
parse Date
return new SimpleDateFormat(sFormat).parse(sValue);
CalendarparseDate(@Nonnull String stringDate)
parse Date
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Date date = sdf.parse(stringDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
DateparseDate(@Nullable String value)
parse Date
return parseDate(value, "yyyy-MM-dd");
StringparseDate(Date date)
parse Date
return sdf.format(date);
StringparseDate(Date date)
Parses a date and returns a formated date string in the form: "yyyy-MM-dd HH:mm:ss z", where z is the time zone.
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
return dateformat.format(date);
DateparseDate(Date date)
parse Date
String format = "dd/mm/yy";
SimpleDateFormat formatter = new SimpleDateFormat(format);
return formatter.parse(date.toString());
StringparseDate(Date date)
Parses a Date to a string using #DATE_STORAGE_FORMAT .
if (date == null) {
    return "never";
return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).format(date);
StringparseDate(Date date)
Return a String for the given java.util.Date as per DATE_FORMAT
if (date == null) {
    return null;
SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT);
formatter.setLenient(false);
return formatter.format(date);
StringparseDate(Date date)
parse Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);
StringparseDate(Date date, int style, Locale local, boolean withTime)
parse Date
if (date == null) {
    return null;
} else {
    DateFormat ft = withTime ? DateFormat.getDateTimeInstance(style, style, local)
            : DateFormat.getDateInstance(style, local);
    return ft.format(date);