Package org.joda.time.format

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()


        // before slash
        char c = leftStr.charAt(0);
        if (c == 'P' || c == 'p') {
            period = periodParser.withParseType(getPeriodType(leftStr)).parsePeriod(leftStr);
        } else {
            DateTime start = dateTimeParser.parseDateTime(leftStr);
            startInstant = start.getMillis();
            parsedChrono = start.getChronology();
        }
       
        // after slash
View Full Code Here


            }
            period = periodParser.withParseType(getPeriodType(rightStr)).parsePeriod(rightStr);
            chrono = (chrono != null ? chrono : parsedChrono);
            endInstant = chrono.add(period, startInstant, 1);
        } else {
            DateTime end = dateTimeParser.parseDateTime(rightStr);
            endInstant = end.getMillis();
            parsedChrono = (parsedChrono != null ? parsedChrono : end.getChronology());
            chrono = (chrono != null ? chrono : parsedChrono);
            if (period != null) {
                startInstant = chrono.add(period, endInstant, -1);
View Full Code Here

        String strValue = (String) value;
        DateTimeFormatter formatter = null;
        try {
          boolean spaces = strValue.indexOf(' ') != -1;
          formatter = ERXRestUtils.jodaLocalDateTimeFormat(spaces, context);
          parsedValue = new LocalDateTime(formatter.parseDateTime(strValue));
        }
        catch (Throwable t) {
          String msg = "Failed to parse '" + strValue + "' as a timestamp";
          if (formatter != null) {
            msg += " (example: " + formatter.print(new LocalDateTime()) + ")";
View Full Code Here

        String strValue = (String) value;
        DateTimeFormatter formatter = null;
        try {
          boolean spaces = strValue.indexOf(' ') != -1;
          formatter = ERXRestUtils.jodaLocalDateFormat(spaces, context);
          parsedValue = new LocalDate(formatter.parseDateTime(strValue));
        }
        catch (Throwable t) {
          String msg = "Failed to parse '" + strValue + "' as a timestamp";
          if (formatter != null) {
            msg += " (example: " + formatter.print(new LocalDate()) + ")";
View Full Code Here

            boolean converted = false;
            int formatter = 0;
            while(!converted) {
                try {
                    DateTimeFormatter dateTimeFormatter = dateFormatters.get(formatter);
                    DateTime dateTime = dateTimeFormatter.parseDateTime(date);
                    result = dateTime.toDate();
                    converted = true;
                } catch (IllegalArgumentException e) {
                    formatter++;
                    if (formatter > dateFormatters.size()) {
View Full Code Here

        protected DateTime getDateField(String column, boolean required) throws IOException {
            String str = getFieldCheckRequired(column, required);
            DateTime dateTime = null;
            if (str != null) try {
                DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd");
                dateTime = formatter.parseDateTime(str);
                checkRangeInclusive(2000, 2100, dateTime.getYear());
            } catch (IllegalArgumentException iae) {
                feed.errors.add(new DateParseError(tableName, row, column));
            }
            return dateTime;
View Full Code Here

   * Extract a date from the given string. Assertion fails when invalid date has been provided.
   */
  protected Date getDateFromISOString(String isoString) {
    DateTimeFormatter dateFormat = ISODateTimeFormat.dateTime();
    try {
      return dateFormat.parseDateTime(isoString).toDate();
    } catch(IllegalArgumentException iae) {
      fail("Illegal date provided: "+ isoString);
      return null;
    }
  }
View Full Code Here

   * Extract a date from the given string. Assertion fails when invalid date has been provided.
   */
  protected Date getDateFromISOString(String isoString) {
    DateTimeFormatter dateFormat = ISODateTimeFormat.dateTime();
    try {
      return dateFormat.parseDateTime(isoString).toDate();
    } catch(IllegalArgumentException iae) {
      fail("Illegal date provided: "+ isoString);
      return null;
    }
  }
View Full Code Here

  @Override
  protected void respond(final AjaxRequestTarget target) {
    final Request r = target.getPage().getRequest();
    final ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString());
    final DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(PFUserContext.getDateTimeZone());
    final DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
        .toDateMidnight();
    final DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
        .toDateMidnight();
    final DateMidnight visibleStart = fmt.parseDateTime(
        r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
View Full Code Here

    final Request r = target.getPage().getRequest();
    final ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString());
    final DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(PFUserContext.getDateTimeZone());
    final DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
        .toDateMidnight();
    final DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
        .toDateMidnight();
    final DateMidnight visibleStart = fmt.parseDateTime(
        r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
    final DateMidnight visibleEnd = fmt
        .parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.