public final class DateUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static Date |
toDate(String aValue,
SimpleDateFormat[] aSimpleDateFormats)
Parses a
String to retrieve a date from it, using the provided
SimpleDateFormat instances. |
public static Date toDate(String aValue, SimpleDateFormat[] aSimpleDateFormats) throws ParseException
String to retrieve a date from it, using the provided
SimpleDateFormat instances. The first one being able to parse a
Date from the String will be used and that Date
is returned. If none SimpleDateFormat instances were able to
parse the provided String, then the first (as being provided in
the array) SimpleDateFormat's parse exception is thrown.aValue - The date String to be parsed.aSimpleDateFormats - The SimpleDateFormat instances to be
tried out, starting with the first one.Date retrieved from the given String.ParseException - Thrown in case none of the provided
SimpleDateFormat instances was able to parse the string.
Then the first caught ParseException is thrown.Copyright © 2016. All rights reserved.