Here you can find the source of parseDashedDateDDMMYYYY(String date)
Parameter | Description |
---|---|
date | a date in dd-MM-yyyy format. |
Parameter | Description |
---|---|
ParseException | if the date cannot be parsed. |
public static Date parseDashedDateDDMMYYYY(String date) throws ParseException
//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); } }