Examples of parseMillis()


Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        } catch (IllegalArgumentException e) {
            // all is well
        }

        // test offset in format
        millis = formatter.parseMillis("1970-01-01T00:00:00-02:00");
        assertThat(millis, equalTo(TimeValue.timeValueHours(2).millis()));
    }

    @Test public void testIsoVsCustom() {
        DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        assertThat(millis, equalTo(TimeValue.timeValueHours(2).millis()));
    }

    @Test public void testIsoVsCustom() {
        DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
        long millis = formatter.parseMillis("1970-01-01T00:00:00");
        assertThat(millis, equalTo(0l));

        formatter = DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").withZone(DateTimeZone.UTC);
        millis = formatter.parseMillis("1970/01/01 00:00:00");
        assertThat(millis, equalTo(0l));
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
        long millis = formatter.parseMillis("1970-01-01T00:00:00");
        assertThat(millis, equalTo(0l));

        formatter = DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").withZone(DateTimeZone.UTC);
        millis = formatter.parseMillis("1970/01/01 00:00:00");
        assertThat(millis, equalTo(0l));

        FormatDateTimeFormatter formatter2 = Joda.forPattern("yyyy/MM/dd HH:mm:ss");
        millis = formatter2.parser().parseMillis("1970/01/01 00:00:00");
        assertThat(millis, equalTo(0l));
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

    @Test public void testWriteAndParse() {
        DateTimeFormatter dateTimeWriter = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC);
        DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
        Date date = new Date();
        assertThat(formatter.parseMillis(dateTimeWriter.print(date.getTime())), equalTo(date.getTime()));
    }

    @Test public void testSlashInFormat() {
        FormatDateTimeFormatter formatter = Joda.forPattern("MM/yyyy");
        formatter.parser().parseMillis("01/2001");
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        for (Object o : (Iterable<?>) sourceData) {
          if (o instanceof String) {
            try {
              String timestamp = (String) o;
              if (timestamp != null && !timestamp.trim().isEmpty()) {
                long timestampParsed = dateParser.parseMillis(timestamp.trim());
                if (timestampParsed > maxTimestampParsed) {
                  maxTimestampParsed = timestampParsed;
                  maxTimestamp = timestamp;
                }
              }
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        try {
          String timestamp = (String) sourceData;
          if (timestamp != null && !timestamp.trim().isEmpty()) {
            timestamp = timestamp.trim();
            // parse it to check format
            dateParser.parseMillis(timestamp);
            maxTimestamp = timestamp;
          }
        } catch (Exception e) {
          String msg = "Value '" + sourceData + "' in filed '" + fieldSource + "'is not valid timestamp";
          addDataWarning(chainContext, msg);
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        for (Object o : (Iterable<?>) sourceData) {
          if (o instanceof String) {
            try {
              String timestamp = (String) o;
              if (timestamp != null && !timestamp.trim().isEmpty()) {
                long timestampParsed = dateParser.parseMillis(timestamp.trim());
                if (timestampParsed > maxTimestampParsed) {
                  maxTimestampParsed = timestampParsed;
                  maxTimestamp = timestamp;
                }
              }
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        try {
          String timestamp = (String) sourceData;
          if (timestamp != null && !timestamp.trim().isEmpty()) {
            timestamp = timestamp.trim();
            // parse it to check format
            dateParser.parseMillis(timestamp);
            maxTimestamp = timestamp;
          }
        } catch (Exception e) {
          logger.debug("Value {} is not valid timestamp", 0);
        }
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        for (Object o : (Iterable<?>) sourceData) {
          if (o instanceof String) {
            try {
              String timestamp = (String) o;
              if (timestamp != null && !timestamp.trim().isEmpty()) {
                long timestampParsed = dateParser.parseMillis(timestamp.trim());
                if (timestampParsed > maxTimestampParsed) {
                  maxTimestampParsed = timestampParsed;
                  maxTimestamp = timestamp;
                }
              }
View Full Code Here

Examples of org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis()

        try {
          String timestamp = (String) sourceData;
          if (timestamp != null && !timestamp.trim().isEmpty()) {
            timestamp = timestamp.trim();
            // parse it to check format
            dateParser.parseMillis(timestamp);
            maxTimestamp = timestamp;
          }
        } catch (Exception e) {
          logger.debug("Value {} is not valid timestamp", 0);
        }
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.