/** * @param value a string representation of a date * @throws ParseException where the specified string is not a valid date */ public Date(final String value) throws ParseException { this(); setTime(getFormat().parse(value).getTime()); }
/** * @param value a string representation of a date * @param pattern a date pattern to apply when parsing * @throws ParseException where the specified string is not a valid date */ public Date(String value, String pattern) throws ParseException { super(pattern, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); setTime(getFormat().parse(value).getTime()); } }
/** * @param value a string representation of a date * @throws ParseException where the specified string is not a valid date */ public Date(final String value) throws ParseException { this(); try { setTime(getFormat().parse(value).getTime()); } catch (ParseException pe) { if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { final DateFormat parseFormat = new SimpleDateFormat(VCARD_PATTERN); parseFormat.setTimeZone(TimeZones.getDateTimeZone()); setTime(parseFormat.parse(value).getTime()); } else { throw pe; } } }
/** * @param value a string representation of a date * @throws ParseException where the specified string is not a valid date */ public Date(final String value) throws ParseException { this(); try { setTime(getFormat().parse(value).getTime()); } catch (ParseException pe) { if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { final DateFormat parseFormat = new SimpleDateFormat(VCARD_PATTERN); parseFormat.setTimeZone(TimeZones.getDateTimeZone()); setTime(parseFormat.parse(value).getTime()); } else { throw pe; } } }
/** * @param value a string representation of a date * @throws ParseException where the specified string is not a valid date */ public Date(final String value) throws ParseException { this(); try { setTime(getFormat().parse(value).getTime()); } catch (ParseException pe) { if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { final DateFormat parseFormat = new SimpleDateFormat(VCARD_PATTERN); parseFormat.setTimeZone(TimeZones.getDateTimeZone()); setTime(parseFormat.parse(value).getTime()); } else { throw pe; } } }
/** * @param value a string representation of a date * @throws ParseException where the specified string is not a valid date */ public Date(final String value) throws ParseException { this(); try { setTime(getFormat().parse(value).getTime()); } catch (ParseException pe) { if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { final DateFormat parseFormat = new SimpleDateFormat(VCARD_PATTERN); parseFormat.setTimeZone(TimeZones.getDateTimeZone()); setTime(parseFormat.parse(value).getTime()); } else { throw pe; } } }