Examples of toFormatter()


Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatterBuilder.toFormatter()

        parsers[0] = DateTimeFormat.forPattern("MM/dd/yyyy").withZone(DateTimeZone.UTC).getParser();
        parsers[1] = DateTimeFormat.forPattern("MM-dd-yyyy").withZone(DateTimeZone.UTC).getParser();
        parsers[2] = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZone(DateTimeZone.UTC).getParser();
        builder.append(DateTimeFormat.forPattern("MM/dd/yyyy").withZone(DateTimeZone.UTC).getPrinter(), parsers);

        DateTimeFormatter formatter = builder.toFormatter();

        formatter.parseMillis("2009-11-15 14:12:12");
    }

    @Test public void testIsoDateFormatDateTimeNoMillisUTC() {
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatterBuilder.toFormatter()

                for (int i = 0; i < formats.length; i++) {
                    parsers[i] = DateTimeFormat.forPattern(formats[i]).withZone(DateTimeZone.UTC).getParser();
                }
                DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder()
                        .append(DateTimeFormat.forPattern(formats[0]).withZone(DateTimeZone.UTC).getPrinter(), parsers);
                formatter = builder.toFormatter();
            }
        }
        return new FormatDateTimeFormatter(input, formatter.withZone(DateTimeZone.UTC));
    }
}
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

    }
    if(useTz) {
      builder.appendLiteral(" ");
      builder.appendTimeZoneShortName();
    }
    return builder.toFormatter();
  }
 

  public static DateTimeFormatter forPattern(String pattern) {
    return forPattern(pattern, false);
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

        // Assume tod is compatible with whatever was built and
        // tod.toISOString() does the correct thing
        builder.appendLiteral("T");
        builder.appendLiteral(tod.toISOString());
      }
      return builder.toFormatter();
    }

    @Override
    public TimexType getTimexType() {
      if (tod != null) return TimexType.TIME;
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

        if (!hasDate) {
          builder.clear();
        }
        appendTimeFormats(builder, flags);
      }
      return builder.toFormatter();
    }

    @Override
    public boolean isGrounded() {
      return false;
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

        new DateTimeFormatterBuilder();
      dateHourMinuteTimezone
        .append(ISODateTimeFormat.dateHourMinute());
      dateHourMinuteTimezone.append(DateTimeFormat.forPattern("ZZ"));
      yearMonthDayHourMinuteZone =
        dateHourMinuteTimezone.toFormatter().withOffsetParsed();
    }
    return yearMonthDayHourMinuteZone;
  }
 
  /**
 
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

                builder.appendLiteral(character);
            }
        }

        try {
            return builder.toFormatter();
        }
        catch (UnsupportedOperationException e) {
            throw new PrestoException(StandardErrorCode.INVALID_FUNCTION_ARGUMENT.toErrorCode(), e);
        }
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

                builder.appendLiteral(character);
            }
        }

        try {
            return builder.toFormatter();
        }
        catch (UnsupportedOperationException e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT.toErrorCode(), e);
        }
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

                builder.appendLiteral(character);
            }
        }

        try {
            return builder.toFormatter();
        }
        catch (UnsupportedOperationException e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT.toErrorCode(), e);
        }
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatterBuilder.toFormatter()

  public static DateTimeFormatter buildDateTimeFormatter(DateTimeFieldType... dateTimeFieldTypes) {
    DateTimeFormatterBuilder b = new DateTimeFormatterBuilder();
    for (DateTimeFieldType dt : dateTimeFieldTypes) {
      b.appendText(dt);
    }
    return b.toFormatter();
  }
}
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.