Java Year Parse parseDashedDateDDMMYYYY(String date)

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

Description

Parses the specified date in dd-MM-yyyy format and returns the Date instance using the system default time zone.

License

MIT License

Parameter

Parameter Description
date a date in dd-MM-yyyy format.

Exception

Parameter Description
ParseException if the date cannot be parsed.

Return

the Date instance.

Declaration

public static Date parseDashedDateDDMMYYYY(String date) throws ParseException 

Method Source Code

//package com.java2s;
/*//w w  w .j a  v a2  s  .c  om
 * Copyright (c) 2015-2016 QuartzDesk.com.
 * Licensed under the MIT license (https://opensource.org/licenses/MIT).
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.TimeZone;

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

    /**
     * Parses the specified date in dd-MM-yyyy format and returns the Date
     * instance using the system default time zone.
     *
     * @param date a date in dd-MM-yyyy format.
     * @return the Date instance.
     * @throws ParseException if the date cannot be parsed.
     */
    public static Date parseDashedDateDDMMYYYY(String date) throws ParseException {
        SimpleDateFormat f = new SimpleDateFormat(DATE_FORMAT_DASHED_DD_MM_YYYY);
        f.setTimeZone(TimeZone.getDefault());
        return f.parse(date);
    }
}

Related

  1. parse2yyyyMMddHHmmss(String date)
  2. parseDateSlashedMmDdYyyy(String dateStr)
  3. parseDateTime_mmddyyyy(String s)
  4. parseDateyyyy_MM_DD2(String ds)
  5. parseDateyyyyMMdd(String value)