protected String expandDate(String date) throws ParseException { // date format is "month/day/year" Date humanDate = df.getPatternInstance("MM.dd.yyyy", ULocale.ENGLISH).parse(date); String[] dateParts = df.format(humanDate).replaceAll(",", "").split("\\s"); dateParts[1] = expandOrdinal(Double.parseDouble(dateParts[1])); dateParts[2] = expandYear(Double.parseDouble(dateParts[2])); return Arrays.toString(dateParts).replaceAll("[,\\]\\[]", ""); }
/** * Parses a date/time string into an Object. This convenience method simply * calls parse(String, ParsePosition). * * @see #parse(String, ParsePosition) * @stable ICU 2.0 */ public Object parseObject (String source, ParsePosition pos) { return parse(source, pos); }
/** * Parses a date/time string into an Object. This convenience method simply * calls parse(String, ParsePosition). * * @see #parse(String, ParsePosition) * @stable ICU 2.0 */ @Override public Object parseObject (String source, ParsePosition pos) { return parse(source, pos); }
/** * Parses a date/time string into an Object. This convenience method simply * calls parse(String, ParsePosition). * * @see #parse(String, ParsePosition) * @stable ICU 2.0 */ public Object parseObject (String source, ParsePosition pos) { return parse(source, pos); }
protected Date parse(String str,int formatterIdx) { if(formatterIdx>=0) { ParsePosition pos=new ParsePosition(0); if (str == null) { return null; } Date date=formatters[formatterIdx].parse(str,pos); if(pos.getErrorIndex()!=-1||pos.getIndex()!=str.length()) { return null; } return date; } try { long millisecs=Long.parseLong(str); return new Date(millisecs); } catch(NumberFormatException exc) { } return null; }
private long extractDate(String[] args, int n) { if (n < args.length) { String line= args[n]; for (int i= 0; i < DATE_FORMATS.length; i++) { DATE_FORMATS[i].setLenient(true); try { Date date= DATE_FORMATS[i].parse(line); return date.getTime(); } catch (ParseException ex) { // silently ignored } } // System.err.println("can't parse date: <" + line + ">"); } return -1; }
protected Date parse(String str,int formatterIdx) { if(formatterIdx>=0) { ParsePosition pos=new ParsePosition(0); if (str == null) { return null; } Date date=formatters[formatterIdx].parse(str,pos); if(pos.getErrorIndex()!=-1||pos.getIndex()!=str.length()) { return null; } return date; } try { long millisecs=Long.parseLong(str); return new Date(millisecs); } catch(NumberFormatException exc) { } return null; }
protected Date parse(String str,int formatterIdx) { if(formatterIdx>=0) { ParsePosition pos=new ParsePosition(0); if (str == null) { return null; } Date date=formatters[formatterIdx].parse(str,pos); if(pos.getErrorIndex()!=-1||pos.getIndex()!=str.length()) { return null; } return date; } try { long millisecs=Long.parseLong(str); return new Date(millisecs); } catch(NumberFormatException exc) { } return null; }
private long extractDate(String[] args, int n) { if (n < args.length) { String line= args[n]; for (int i= 0; i < this.fDateFormats.length; i++) { this.fDateFormats[i].setLenient(true); try { Date date= this.fDateFormats[i].parse(line); return date.getTime(); } catch (ParseException ex) { // silently ignored } } // System.err.println("can't parse date: <" + line + ">"); } return IFilePatch2.DATE_UNKNOWN; }
Date result = parse(text, pos); if (pos.getIndex() == 0) // ICU4J throw new ParseException("Unparseable date: \"" + text + "\"" ,
Date date = formatter.parse(dateBuffer.toString()); if (date != null) fDate = date;
@Override public Date parseDate(String locale, String value, String skeleton, String timezone) throws ParseException { ULocale closestLocale = findClosestULocale(locale); DateFormat formatter = DateFormat.getPatternInstance(skeleton, closestLocale); if (StringUtils.isNotEmpty(timezone)) { formatter.setTimeZone(TimeZone.getTimeZone(timezone)); } return formatter.parse(value); }
Date date = formatter.parse(dateBuffer.toString()); if (date != null) fDate = date;
@Override public Date parseDate(String locale, String value, String skeleton, String timezone) throws ParseException { ULocale closestLocale = localeService.getClosestULocale(locale); DateFormat formatter = DateFormat.getPatternInstance(skeleton, closestLocale); if (StringUtils.isNotEmpty(timezone)) { formatter.setTimeZone(TimeZone.getTimeZone(timezone)); } return formatter.parse(value); }
Date date = GREGORIAN_SDF.parse(dateBuffer.toString()); if (date != null) { fDate = date;
Date date = GREGORIAN_SDF.parse(dateBuffer.toString()); if (date != null) { fDate = date;
Date fdate = DateFormat.getInstance().parse(tmp); return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(fdate);
TimeZone tzsav = calendar.getTimeZone(); calendar.clear(); parse(text, calendar, pos); if (pos.getIndex() != start) { try {