Package edu.byu.hbll.box.internal.util
Class FlexDateParser
- java.lang.Object
-
- edu.byu.hbll.box.internal.util.FlexDateParser
-
public class FlexDateParser extends Object
Flexible date parsing utility class.
-
-
Field Summary
Fields Modifier and Type Field Description static DateTimeFormatter
FORMATTER
-
Constructor Summary
Constructors Constructor Description FlexDateParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Instant
parse(String text)
Parses an ISO date string into anInstant
assuming the system timezone.static Instant
parse(String text, ZoneId defaultZoneId)
Parses an ISO date string into anInstant
assuming the given timezone.
-
-
-
Field Detail
-
FORMATTER
public static final DateTimeFormatter FORMATTER
-
-
Method Detail
-
parse
public static Instant parse(String text) throws DateTimeParseException
Parses an ISO date string into anInstant
assuming the system timezone.- Parameters:
text
- date to parse- Returns:
- the parsed date
- Throws:
DateTimeParseException
- if date is unparseable
-
parse
public static Instant parse(String text, ZoneId defaultZoneId) throws DateTimeParseException
Parses an ISO date string into anInstant
assuming the given timezone.- Parameters:
text
- date to parsedefaultZoneId
- the timezone to use if not specified in date string- Returns:
- the parsed date
- Throws:
DateTimeParseException
- if date is unparseable
-
-