@SuppressWarnings("deprecation") public Date parse(DateBox dateBox, String dateText, boolean reportError) { Date date = null; try { if (dateText.length() > 0) { date = dateTimeFormat.parse(dateText); } } catch (IllegalArgumentException exception) { try { date = new Date(dateText); // We have parsed the text at higher resolution so do a round trip to get rid of extra: date = dateTimeFormat.parse(dateTimeFormat.format(date)); } catch (IllegalArgumentException e) { if (reportError) { dateBox.addStyleName(DATE_BOX_FORMAT_ERROR); } return null; } } return date; }
private static Date parseDate( String string ) { try { return SQLite.dateTimeFormat.parse( string ); } catch( Exception e ) { return null; } } }
/** * <br/> */ public Date convertStringValue(String value) { return formatter.parse(value); }
@Override public Date parseDate(String pattern, String d) { DateTimeFormat df = getDateFormat(pattern); return df.parse(d); }
public Date parse(String cellContent) { if (dateTimeFormat == null) { dateTimeFormat = DateTimeFormat.getFormat(datePattern); } try { return dateTimeFormat.parse(cellContent); } catch (IllegalArgumentException e) { return null; } }
public String validate(Field<?> field, String value) { try { dtFormat.parse(value); } catch (IllegalArgumentException e) { return messages.vmInvalid(); } return null; } });
/** * Parses the given value as a date using the configured date format. * @param value */ private Date parseDate(String value) { if (value == null || "".equals(value)) //$NON-NLS-1$ return null; DateTimeFormat format = getFormat(); return format.parse(value); }
public Date getStartFromYearMonthDay() { Date iso = null; final String isoString = getISOStart(); if (isoString != null && isoString.length() >= 10) { iso = DateTimeFormat.getFormat("yyyy-MM-dd").parse(isoString.substring(0, 10)); } return iso; }
public Date getEndFromYearMonthDay() { Date iso = null; final String isoString = getISOEnd(); if (isoString != null && isoString.length() >= 10) { iso = DateTimeFormat.getFormat("yyyy-MM-dd").parse(isoString.substring(0, 10)); } return iso; }
/** * {@inheritDoc} */ @Override public Date getValue() { try { return dtf != null && box.getValue() != null ? dtf.parse(box.getValue()) : null; } catch(Exception e) { return null; } }
/** * {@inheritDoc} */ @Override public Date getValue() { try { return dtf != null && box.getValue() != null ? dtf.parse(box.getValue()) : null; } catch (Exception e) { return null; } }
static DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss.SSS"); static DateTimeFormat datefmt = DateTimeFormat.getFormat("yyyy-MM-dd "); static DateTimeFormat timefmt = DateTimeFormat.getFormat("HH:mm:ss.SSS"); public Date getDateTime(Date date, Date time) { String datetime = datefmt.format(date) + timefmt.format(time); return dtf.parse(datetime); }
/** * {@inheritDoc} */ @Override public Date getValue() { try { return dtf != null && box.getValue() != null ? dtf.parse(box.getValue()) : null; } catch(Exception e) { return null; } }
/** {@inheritDoc} */ @Override public Date getValue() { try { return dateTimeFormat != null && textBox.getValue() != null ? dateTimeFormat.parse(textBox.getValue()) : null; } catch (final Exception e) { return null; } }
private Date assertDateValue(final RuleAttribute ruleAttribute) { if (ruleAttribute == null || ruleAttribute.getValue() == null) { return null; } try { final Date d = DATE_FORMATTER.parse(ruleAttribute.getValue()); return d; } catch (IllegalArgumentException iae) { return null; } } }
@Override public void setWidgetValue(KSDatePicker widget, DataModel model, String path) { String value = model.get(path); if (value != null) { widget.setValue(ProgramUtils.df.parse(value)); } } }
/** {@inheritDoc} */ @Override public Date getValue() { try { return dateTimeFormat != null && textBox.getValue() != null ? dateTimeFormat.parse(textBox.getValue()) : null; } catch (final Exception e) { return null; } }
public Date parseDate(String format) { if (isValid(format)) { valuebox.clearStatusText(); return DateTimeFormat.getFormat(format).parse(valuebox.getText()); } return null; }
@Override //We don't delegate this to the wrapped DatePicker as that has some issues with the mismatch between GWT's DateFormat and BS3's DateFormat public Date getValue() { try { return gwtDateTimeFormat != null && datePicker.getTextBox().getValue() != null ? gwtDateTimeFormat.parse(datePicker.getTextBox().getValue()) : null; } catch (final Exception e) { return null; } }
public void onKeyUp(KeyUpEvent event) { try { String exampleDate = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(new Date()); String suggestedDate = textBox.getText() + exampleDate.substring(textBox.getText().length()); Date d = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).parse(suggestedDate); dateHint.setText( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(d) ); } catch ( Exception e ) { dateHint.setText( "..." ); } } } );