Examples of parseMillis()


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

    DateTimeFormatter jodaParser = ISODateTimeFormat.dateTimeParser();

    for (String ex : examples) {
      Assert.assertEquals(
          "Problem parsing date string: " + ex,
          jodaParser.parseMillis(ex),
          parser.parseRfc5424Date(ex));
    }
  }

  @Test
View Full Code Here

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

            // Convert String to Calendar or sql.Date/Time/Timestamp
            // First convert it to a milliseconds. We think it's GMT because no TZ is specified in the String.
            long date;
            try {
                DateTimeFormatter dateFmt = getFormat().withZone(DateTimeZone.UTC);
                date = dateFmt.parseMillis(value);
            }
            catch (IllegalArgumentException e) {
                throw new ConversionException("Cannot convert '" + value + "' to a Date.")
                    .setSourceValue(value)
                    .setTargetType(type)
View Full Code Here

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

    DateTimeFormatter jodaParser = ISODateTimeFormat.dateTimeParser();

    for (String ex : examples) {
      Assert.assertEquals(
          "Problem parsing date string: " + ex,
          jodaParser.parseMillis(ex),
          parser.parseRfc5424Date(ex));
    }
  }

  @Test
View Full Code Here

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

            checkNotNull(columnHandle.getFormatHint(), "formatHint is null");
            String textValue = value.isValueNode() ? value.asText() : value.toString();

            DateTimeFormatter formatter = DateTimeFormat.forPattern(columnHandle.getFormatHint()).withLocale(Locale.ENGLISH).withZoneUTC();
            return formatter.parseMillis(textValue);
        }
    }
}
View Full Code Here

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

    DateTimeFormatter jodaParser = ISODateTimeFormat.dateTimeParser();

    for (String ex : examples) {
      Assert.assertEquals(
          "Problem parsing date string: " + ex,
          jodaParser.parseMillis(ex),
          parser.parseRfc5424Date(ex));
    }
  }

  @Test
View Full Code Here

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

  @Test
  public void testDateRace() {
    Clock mockClock = mock(Clock.class);
    DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser();
    long two = parser.parseMillis("2013-04-21T02:59:59-00:00");
    long three = parser.parseMillis("2013-04-21T03:00:00-00:00");
    when(mockClock.currentTimeMillis()).thenReturn(two, three);

    // save & modify static state (yuck)
    Clock origClock = BucketPath.getClock();
View Full Code Here

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

  @Test
  public void testDateRace() {
    Clock mockClock = mock(Clock.class);
    DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser();
    long two = parser.parseMillis("2013-04-21T02:59:59-00:00");
    long three = parser.parseMillis("2013-04-21T03:00:00-00:00");
    when(mockClock.currentTimeMillis()).thenReturn(two, three);

    // save & modify static state (yuck)
    Clock origClock = BucketPath.getClock();
    BucketPath.setClock(mockClock);
View Full Code Here

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

    return date + " 23:59:59 " + tz.getDisplayName(true, TimeZone.SHORT);
  }
 
  public static long time(String s) throws ParseException {
    DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss z");
      long time = formatter.parseMillis(s);
      return time;
  }
 
  public static final long fromMidnight(long time, TimeZone tz) {
    Calendar c = Calendar.getInstance(tz);
View Full Code Here

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

    {
        DateTimeFormatter formatter = DATETIME_FORMATTER_CACHE.get(formatString)
                .withChronology(getChronology(session.getTimeZoneKey()))
                .withLocale(session.getLocale());

        return formatter.parseMillis(dateTime.toString(Charsets.UTF_8));
    }

    @Description("second of the minute of the given timestamp")
    @ScalarFunction("second")
    @SqlType(BigintType.class)
View Full Code Here

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

        DateTimeFormatter formatter = DATETIME_FORMATTER_CACHE.get(formatString)
                .withChronology(getChronology(session.getTimeZoneKey()))
                .withLocale(session.getLocale());

        try {
            return formatter.parseMillis(dateTime.toString(Charsets.UTF_8));
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(StandardErrorCode.INVALID_FUNCTION_ARGUMENT.toErrorCode(), e);
        }
    }
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.