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