Java 类org.joda.time.DateTimeFieldType 实例源码

项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
/**
 * Creates a date using the ordinal date format.
 * Specification reference: 5.2.2.
 *
 * @param bld  the builder
 * @param fields  the fields
 * @param extended  true to use extended format
 * @since 1.1
 */
private static boolean dateByOrdinal(
        DateTimeFormatterBuilder bld,
        Collection<DateTimeFieldType> fields,
        boolean extended) {

    boolean reducedPrec = false;
    if (fields.remove(DateTimeFieldType.year())) {
        bld.append(Constants.ye);
        if (fields.remove(DateTimeFieldType.dayOfYear())) {
            // YYYY-DDD/YYYYDDD
            appendSeparator(bld, extended);
            bld.appendDayOfYear(3);
        } else {
            // YYYY/YYYY
            reducedPrec = true;
        }

    } else if (fields.remove(DateTimeFieldType.dayOfYear())) {
        // -DDD/-DDD
        bld.appendLiteral('-');
        bld.appendDayOfYear(3);
    }
    return reducedPrec;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
/**
 * Creates a date using the ordinal date format.
 * Specification reference: 5.2.2.
 *
 * @param bld  the builder
 * @param fields  the fields
 * @param extended  true to use extended format
 * @param strictISO  true to only allow ISO formats
 * @since 1.1
 */
private static boolean dateByOrdinal(
        DateTimeFormatterBuilder bld,
        Collection<DateTimeFieldType> fields,
        boolean extended,
        boolean strictISO) {

    boolean reducedPrec = false;
    if (fields.remove(DateTimeFieldType.year())) {
        bld.append(Constants.ye);
        if (fields.remove(DateTimeFieldType.dayOfYear())) {
            // YYYY-DDD/YYYYDDD
            appendSeparator(bld, extended);
            bld.appendDayOfYear(3);
        } else {
            // YYYY/YYYY
            reducedPrec = true;
        }

    } else if (fields.remove(DateTimeFieldType.dayOfYear())) {
        // -DDD/-DDD
        bld.appendLiteral('-');
        bld.appendDayOfYear(3);
    }
    return reducedPrec;
}
项目:hyperrail-for-android    文件:RouteSearchFragment.java   
@Override
public void onDateTimePicked(DateTime d) {
    searchDateTime = d;

    DateTime now = new DateTime();

    DateTimeFormatter df = DateTimeFormat.forPattern("dd MMMM yyyy");
    DateTimeFormatter tf = DateTimeFormat.forPattern("HH:mm");

    String day = df.print(searchDateTime);
    String time = tf.print(searchDateTime);
    String at = getActivity().getResources().getString(R.string.time_at);

    if (now.get(DateTimeFieldType.year()) == searchDateTime.get(DateTimeFieldType.year())) {
        if (now.get(DateTimeFieldType.dayOfYear()) == searchDateTime.get(DateTimeFieldType.dayOfYear())) {
            day = getActivity().getResources().getString(R.string.time_today);
        } else  //noinspection RedundantCast
            if (now.get(DateTimeFieldType.dayOfYear()) + 1 == (int) searchDateTime.get(DateTimeFieldType.dayOfYear())) {
                day = getActivity().getResources().getString(R.string.time_tomorrow);
            }
    }
    vDatetime.setText(day + " " + at + " " + time);
}
项目:FHWS-Lectures    文件:EventListFragment.java   
public void setData(List<Event> events, GregorianCalendar calendar) {
    _eventsToDisplay = new ArrayList<>();
    this._calendar = calendar;
    for (Event e : events) {
        DateTime beginTime = e.getBeginDateTime();
        DateTime endTime = e.getEndDateTime();

        if (beginTime.get(DateTimeFieldType.dayOfYear()) <= calendar.get(Calendar.DAY_OF_YEAR)
                && beginTime.get(DateTimeFieldType.year()) <= calendar.get(Calendar.YEAR)
                && endTime.get(DateTimeFieldType.dayOfYear()) >= calendar.get(Calendar.DAY_OF_YEAR)
                && endTime.get(DateTimeFieldType.year()) >= calendar.get(Calendar.DAY_OF_YEAR)) {
            _eventsToDisplay.add(e);
        }
    }
    if(_view != null){
        setAdapter();
    }
}
项目:TinyTravelTracker    文件:RemainderDateTimeField.java   
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param type  the field type this field actually uses
 * @param divisor  divisor, such as 100 years in a century
 * @throws IllegalArgumentException if divisor is less than two
 */
public RemainderDateTimeField(DateTimeField field,
                              DateTimeFieldType type, int divisor) {
    super(field, type);

    if (divisor < 2) {
        throw new IllegalArgumentException("The divisor must be at least 2");
    }

    DurationField rangeField = field.getDurationField();
    if (rangeField == null) {
        iRangeField = null;
    } else {
        iRangeField = new ScaledDurationField(
            rangeField, type.getRangeDurationType(), divisor);
    }

    iDivisor = divisor;
}
项目:TinyTravelTracker    文件:PreciseDateTimeField.java   
/**
 * Constructor.
 * 
 * @param type  the field type this field uses
 * @param unit  precise unit duration, like "seconds()".
 * @param range precise range duration, preferably a multiple of the unit,
 * like "minutes()".
 * @throws IllegalArgumentException if either duration field is imprecise
 * @throws IllegalArgumentException if unit milliseconds is less than one
 * or effective value range is less than two.
 */
public PreciseDateTimeField(DateTimeFieldType type,
                            DurationField unit, DurationField range) {
    super(type, unit);

    if (!range.isPrecise()) {
        throw new IllegalArgumentException("Range duration field must be precise");
    }

    long rangeMillis = range.getUnitMillis();
    iRange = (int)(rangeMillis / getUnitMillis());
    if (iRange < 2) {
        throw new IllegalArgumentException("The effective range must be at least 2");
    }

    iRangeField = range;
}
项目:TinyTravelTracker    文件:DividedDateTimeField.java   
/**
 * Construct a DividedDateTimeField that compliments the given
 * RemainderDateTimeField.
 *
 * @param remainderField  complimentary remainder field, like "yearOfCentury()".
 * @param type  the field type this field will actually use
 */
public DividedDateTimeField(RemainderDateTimeField remainderField, DateTimeFieldType type) {
    super(remainderField.getWrappedField(), type);
    int divisor = iDivisor = remainderField.iDivisor;
    iDurationField = remainderField.iRangeField;

    DateTimeField field = getWrappedField();
    int i = field.getMinimumValue();
    int min = (i >= 0) ? i / divisor : ((i + 1) / divisor - 1);

    int j = field.getMaximumValue();
    int max = (j >= 0) ? j / divisor : ((j + 1) / divisor - 1);

    iMin = min;
    iMax = max;
}
项目:TinyTravelTracker    文件:BasicChronology.java   
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
项目:teasy    文件:AbstractPageElement.java   
@Deprecated
protected void postponedAssertDateEquals(DateTime actualDate, DateTime expectedDate, String dateFieldName) {
    postponedAssertEquals(actualDate.year().get(), expectedDate.year().get(), "Incorrect field 'year' in " + dateFieldName);
    postponedAssertEquals(actualDate.monthOfYear().get(), expectedDate.monthOfYear().get(), "Incorrect field 'month' in " + dateFieldName);
    postponedAssertEquals(actualDate.dayOfMonth().get(), expectedDate.dayOfMonth().get(), "Incorrect field 'day' in " + dateFieldName);
    postponedAssertEquals(actualDate.hourOfDay().get(), expectedDate.hourOfDay().get(), "Incorrect field 'hour' in " + dateFieldName);
    postponedAssertTrue(Math.abs(actualDate.minuteOfHour().get() - expectedDate.minuteOfHour().get()) <= 1,
            "Incorrect field 'minute' in " + dateFieldName + ". Actual - " + actualDate.minuteOfHour().get()
                    + " . Expected - " + expectedDate.minuteOfHour().get());
    postponedAssertEquals(actualDate.get(DateTimeFieldType.halfdayOfDay()), expectedDate.get(DateTimeFieldType.halfdayOfDay()),
            "Incorrect field 'halfdayOfDay' in start date" + dateFieldName);
}
项目:os    文件:BillNoUtils.java   
public static void main(String[] args) throws NoSuchAlgorithmException {

    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
    for (int i=1; i<=1440; i++) {
        System.out.println("maps.put(\"20141109-"+i+"\", \""+sr.nextInt(10)+" "+sr.nextInt(10)+" "+sr.nextInt(10)+" "+sr.nextInt(10)+" "+sr.nextInt(10)+"\");");
    }

    System.out.println(LocalDate.now());
    Instant in = new Instant(1414508801016L);
    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
    formatter=formatter.withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+8")));

    in = in.plus(100);

    System.out.println(in.get(DateTimeFieldType.millisOfSecond()));

    System.out.println(in.toDate());
    System.out.println(formatter.print(in));
    System.out.println(in.getMillis());
    Pattern pattern = Pattern.compile("\"phase\":\"20141018023\"(.*)\"data\":\\[\"(\\d)\",\"(\\d)\",\"(\\d)\",\"(\\d)\",\"(\\d)\"\\]\\}\\]\\}");
    Matcher matcher = pattern.matcher("{\"code\":0,\"message\":\"\",\"data\":[{\"phasetype\":200,\"phase\":\"20141018023\",\"create_at\":\"2014-01-21 14:41:05\",\"time_startsale\":\"2014-10-18 01:50:00\",\"time_endsale\":\"2014-10-18 01:55:00\",\"time_endticket\":\"2014-10-18 01:55:00\",\"time_draw\":\"2014-10-18 01:56:00\",\"status\":5,\"forsale\":0,\"is_current\":0,\"result\":{\"result\":[{\"key\":\"ball\",\"data\":[\"1\",\"5\",\"0\",\"5\",\"9\"]}]},\"result_detail\":{\"resultDetail\":[{\"key\":\"prize1\",\"bet\":\"0\",\"prize\":100000},{\"key\":\"prize2\",\"bet\":\"0\",\"prize\":20000},{\"key\":\"prize3\",\"bet\":\"0\",\"prize\":200},{\"key\":\"prize4\",\"bet\":\"0\",\"prize\":20},{\"key\":\"prize5\",\"bet\":\"0\",\"prize\":1000},{\"key\":\"prize6\",\"bet\":\"0\",\"prize\":320},{\"key\":\"prize7\",\"bet\":\"0\",\"prize\":160},{\"key\":\"prize8\",\"bet\":\"0\",\"prize\":100},{\"key\":\"prize9\",\"bet\":\"0\",\"prize\":50},{\"key\":\"prize10\",\"bet\":\"0\",\"prize\":10},{\"key\":\"prize11\",\"bet\":\"0\",\"prize\":4}]},\"pool_amount\":\"\",\"sale_amount\":\"\",\"ext\":\"\",\"fc3d_sjh\":null,\"terminal_status\":2,\"fordraw\":0,\"time_startsale_fixed\":\"2014-10-18 01:47:40\",\"time_endsale_fixed\":\"2014-10-18 01:52:40\",\"time_endsale_syndicate_fixed\":\"2014-10-18 01:55:00\",\"time_endsale_upload_fixed\":\"2014-10-18 01:55:00\",\"time_draw_fixed\":\"2014-10-18 01:56:00\",\"time_startsale_correction\":140,\"time_endsale_correction\":140,\"time_endsale_syndicate_correction\":0,\"time_endsale_upload_correction\":0,\"time_draw_correction\":0,\"time_exchange\":\"2014-12-16 01:56:00\"},{\"phasetype\":\"200\",\"phase\":\"20141018024\",\"create_at\":\"2014-01-21 14:41:05\",\"time_startsale\":\"2014-10-18 01:55:00\",\"time_endsale\":\"2014-10-18 10:00:00\",\"time_endticket\":\"2014-10-18 10:00:00\",\"time_draw\":\"2014-10-18 10:01:00\",\"status\":\"2\",\"forsale\":\"1\",\"is_current\":\"1\",\"result\":null,\"result_detail\":null,\"pool_amount\":\"\",\"sale_amount\":\"\",\"ext\":\"\",\"fc3d_sjh\":null,\"terminal_status\":\"1\",\"fordraw\":\"0\",\"time_startsale_fixed\":\"2014-10-18 01:52:40\",\"time_endsale_fixed\":\"2014-10-18 09:57:40\",\"time_endsale_syndicate_fixed\":\"2014-10-18 10:00:00\",\"time_endsale_upload_fixed\":\"2014-10-18 10:00:00\",\"time_draw_fixed\":\"2014-10-18 10:01:00\",\"time_startsale_correction\":140,\"time_endsale_correction\":140,\"time_endsale_syndicate_correction\":0,\"time_endsale_upload_correction\":0,\"time_draw_correction\":0,\"time_exchange\":\"2014-12-16 10:01:00\"}],\"redirect\":\"\",\"datetime\":\"2014-10-18 04:08:45\",\"timestamp\":1413576525}");

    //Pattern pattern = Pattern.compile("(.*)message(\\d\\d)(\\d)(\\d)(\\d)");
    //Matcher matcher = pattern.matcher("23fawef_message12345");
    //Pattern pattern = Pattern.compile("\"number\":\"(\\d) (\\d) (\\d) (\\d) (\\d)\",\"period\":\"20141017083");
    //Matcher matcher = pattern.matcher("{\"latestPeriods\":[{\"number\":\"6 0 2 2 1\",\"period\":\"20141017084\"},{\"number\":\"0 8 9 1 9\",\"period\":\"20141017083\"},{\"number\":\"4 0 4 4 6\",\"period\":\"20141017082\"},{\"number\":\"4 5 8 7 7\",\"period\":\"20141017081\"},{\"number\":\"7 2 8 5 3\",\"period\":\"20141017080\"},{\"number\":\"9 7 3 8 0\",\"period\":\"20141017079\"},{\"number\":\"3 7 6 0 1\",\"period\":\"20141017078\"},{\"number\":\"9 6 4 8 5\",\"period\":\"20141017077\"},{\"number\":\"6 4 1 8 1\",\"period\":\"20141017076\"},{\"number\":\"9 5 2 8 7\",\"period\":\"20141017075\"}],\"successful\":\"true\",\"statusDesc\":\"获取数据成功\"}");

    matcher.find();
    for (int i=1; i<=matcher.groupCount(); i++) {

            System.out.println(matcher.group(i));

    }
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicDate() {
    if (bd == null) {
        return new DateTimeFormatterBuilder()
                .appendYear(4, 4)
                .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
                .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
                .toFormatter();
    }
    return bd;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicTime() {
    if (bt == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedDecimal(DateTimeFieldType.hourOfDay(), 2)
                .appendFixedDecimal(DateTimeFieldType.minuteOfHour(), 2)
                .appendFixedDecimal(DateTimeFieldType.secondOfMinute(), 2)
                .appendLiteral('.')
                .appendFractionOfSecond(3, 9)
                .appendTimeZoneOffset("Z", false, 2, 2)
                .toFormatter();
    }
    return bt;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicTimeNoMillis() {
    if (btx == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedDecimal(DateTimeFieldType.hourOfDay(), 2)
                .appendFixedDecimal(DateTimeFieldType.minuteOfHour(), 2)
                .appendFixedDecimal(DateTimeFieldType.secondOfMinute(), 2)
                .appendTimeZoneOffset("Z", false, 2, 2)
                .toFormatter();
    }
    return btx;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicOrdinalDate() {
    if (bod == null) {
        return new DateTimeFormatterBuilder()
                .appendYear(4, 4)
                .appendFixedDecimal(DateTimeFieldType.dayOfYear(), 3)
                .toFormatter();
    }
    return bod;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicWeekDate() {
    if (bwd == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.weekyear(), 4) // ES change, was .appendWeekyear(4, 4)
                .appendLiteral('W')
                .appendFixedDecimal(DateTimeFieldType.weekOfWeekyear(), 2)
                .appendFixedDecimal(DateTimeFieldType.dayOfWeek(), 1)
                .toFormatter();
    }
    return bwd;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter yearElement() {
    if (ye == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.year(), 4) // ES change, was .appendYear(4, 9)
                .toFormatter();
    }
    return ye;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter monthElement() {
    if (mye == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.monthOfYear(), 2) // ES change, was .appendMonthOfYear(2)
                .toFormatter();
    }
    return mye;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter dayOfMonthElement() {
    if (dme == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.dayOfMonth(), 2) // ES change, was .appendDayOfMonth(2)
                .toFormatter();
    }
    return dme;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter weekyearElement() {
    if (we == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.weekyear(), 4) // ES change, was .appendWeekyear(4, 9)
                .toFormatter();
    }
    return we;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter weekElement() {
    if (wwe == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral("-W")
                .appendFixedSignedDecimal(DateTimeFieldType.weekOfWeekyear(), 2) // ES change, was .appendWeekOfWeekyear(2)
                .toFormatter();
    }
    return wwe;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter dayOfYearElement() {
    if (dye == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.dayOfYear(), 3) // ES change, was .appendDayOfYear(3)
                .toFormatter();
    }
    return dye;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter hourElement() {
    if (hde == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.hourOfDay(), 2) // ES change, was .appendHourOfDay(2)
                .toFormatter();
    }
    return hde;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter minuteElement() {
    if (mhe == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral(':')
                .appendFixedSignedDecimal(DateTimeFieldType.minuteOfHour(), 2) // ES change, was .appendMinuteOfHour(2)
                .toFormatter();
    }
    return mhe;
}
项目:elasticsearch_my    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter secondElement() {
    if (sme == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral(':')
                .appendFixedSignedDecimal(DateTimeFieldType.secondOfMinute(), 2) // ES change, was .appendSecondOfMinute(2)
                .toFormatter();
    }
    return sme;
}
项目:elasticsearch_my    文件:Joda.java   
public static FormatDateTimeFormatter getStrictStandardDateFormatter() {
    // 2014/10/10
    DateTimeFormatter shortFormatter = new DateTimeFormatterBuilder()
            .appendFixedDecimal(DateTimeFieldType.year(), 4)
            .appendLiteral('/')
            .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
            .appendLiteral('/')
            .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
            .toFormatter()
            .withZoneUTC();

    // 2014/10/10 12:12:12
    DateTimeFormatter longFormatter = new DateTimeFormatterBuilder()
            .appendFixedDecimal(DateTimeFieldType.year(), 4)
            .appendLiteral('/')
            .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
            .appendLiteral('/')
            .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
            .appendLiteral(' ')
            .appendFixedSignedDecimal(DateTimeFieldType.hourOfDay(), 2)
            .appendLiteral(':')
            .appendFixedSignedDecimal(DateTimeFieldType.minuteOfHour(), 2)
            .appendLiteral(':')
            .appendFixedSignedDecimal(DateTimeFieldType.secondOfMinute(), 2)
            .toFormatter()
            .withZoneUTC();

    DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder().append(longFormatter.withZone(DateTimeZone.UTC).getPrinter(), new DateTimeParser[]{longFormatter.getParser(), shortFormatter.getParser(), new EpochTimeParser(true)});

    return new FormatDateTimeFormatter("yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis", builder.toFormatter().withZone(DateTimeZone.UTC), Locale.ROOT);
}
项目:elasticsearch_my    文件:Joda.java   
@Override
public int parseInto(DateTimeParserBucket bucket, String text, int position) {
    boolean isPositive = text.startsWith("-") == false;
    boolean isTooLong = text.length() > estimateParsedLength();

    if ((isPositive && isTooLong) ||
        // timestamps have to have UTC timezone
        bucket.getZone() != DateTimeZone.UTC) {
        return -1;
    }

    int factor = hasMilliSecondPrecision ? 1 : 1000;
    try {
        long millis = Long.valueOf(text) * factor;
        DateTime dt = new DateTime(millis, DateTimeZone.UTC);
        bucket.saveField(DateTimeFieldType.year(), dt.getYear());
        bucket.saveField(DateTimeFieldType.monthOfYear(), dt.getMonthOfYear());
        bucket.saveField(DateTimeFieldType.dayOfMonth(), dt.getDayOfMonth());
        bucket.saveField(DateTimeFieldType.hourOfDay(), dt.getHourOfDay());
        bucket.saveField(DateTimeFieldType.minuteOfHour(), dt.getMinuteOfHour());
        bucket.saveField(DateTimeFieldType.secondOfMinute(), dt.getSecondOfMinute());
        bucket.saveField(DateTimeFieldType.millisOfSecond(), dt.getMillisOfSecond());
        bucket.setZone(DateTimeZone.UTC);
    } catch (Exception e) {
        return -1;
    }
    return text.length();
}
项目:elasticsearch_my    文件:Joda.java   
private long getDateTimeMillis(ReadablePartial partial) {
    int year = partial.get(DateTimeFieldType.year());
    int monthOfYear = partial.get(DateTimeFieldType.monthOfYear());
    int dayOfMonth = partial.get(DateTimeFieldType.dayOfMonth());
    int hourOfDay = partial.get(DateTimeFieldType.hourOfDay());
    int minuteOfHour = partial.get(DateTimeFieldType.minuteOfHour());
    int secondOfMinute = partial.get(DateTimeFieldType.secondOfMinute());
    int millisOfSecond = partial.get(DateTimeFieldType.millisOfSecond());
    return partial.getChronology().getDateTimeMillis(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicDate() {
    if (bd == null) {
        return new DateTimeFormatterBuilder()
                .appendYear(4, 4)
                .appendFixedDecimal(DateTimeFieldType.monthOfYear(), 2)
                .appendFixedDecimal(DateTimeFieldType.dayOfMonth(), 2)
                .toFormatter();
    }
    return bd;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicTime() {
    if (bt == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedDecimal(DateTimeFieldType.hourOfDay(), 2)
                .appendFixedDecimal(DateTimeFieldType.minuteOfHour(), 2)
                .appendFixedDecimal(DateTimeFieldType.secondOfMinute(), 2)
                .appendLiteral('.')
                .appendFractionOfSecond(3, 9)
                .appendTimeZoneOffset("Z", false, 2, 2)
                .toFormatter();
    }
    return bt;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicTimeNoMillis() {
    if (btx == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedDecimal(DateTimeFieldType.hourOfDay(), 2)
                .appendFixedDecimal(DateTimeFieldType.minuteOfHour(), 2)
                .appendFixedDecimal(DateTimeFieldType.secondOfMinute(), 2)
                .appendTimeZoneOffset("Z", false, 2, 2)
                .toFormatter();
    }
    return btx;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicOrdinalDate() {
    if (bod == null) {
        return new DateTimeFormatterBuilder()
                .appendYear(4, 4)
                .appendFixedDecimal(DateTimeFieldType.dayOfYear(), 3)
                .toFormatter();
    }
    return bod;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter basicWeekDate() {
    if (bwd == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.weekyear(), 4) // ES change, was .appendWeekyear(4, 4)
                .appendLiteral('W')
                .appendFixedDecimal(DateTimeFieldType.weekOfWeekyear(), 2)
                .appendFixedDecimal(DateTimeFieldType.dayOfWeek(), 1)
                .toFormatter();
    }
    return bwd;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter yearElement() {
    if (ye == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.year(), 4) // ES change, was .appendYear(4, 9)
                .toFormatter();
    }
    return ye;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter monthElement() {
    if (mye == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.monthOfYear(), 2) // ES change, was .appendMonthOfYear(2)
                .toFormatter();
    }
    return mye;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter dayOfMonthElement() {
    if (dme == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.dayOfMonth(), 2) // ES change, was .appendDayOfMonth(2)
                .toFormatter();
    }
    return dme;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter weekyearElement() {
    if (we == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.weekyear(), 4) // ES change, was .appendWeekyear(4, 9)
                .toFormatter();
    }
    return we;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter weekElement() {
    if (wwe == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral("-W")
                .appendFixedSignedDecimal(DateTimeFieldType.weekOfWeekyear(), 2) // ES change, was .appendWeekOfWeekyear(2)
                .toFormatter();
    }
    return wwe;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter dayOfYearElement() {
    if (dye == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral('-')
                .appendFixedSignedDecimal(DateTimeFieldType.dayOfYear(), 3) // ES change, was .appendDayOfYear(3)
                .toFormatter();
    }
    return dye;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter hourElement() {
    if (hde == null) {
        return new DateTimeFormatterBuilder()
                .appendFixedSignedDecimal(DateTimeFieldType.hourOfDay(), 2) // ES change, was .appendHourOfDay(2)
                .toFormatter();
    }
    return hde;
}
项目:Elasticsearch    文件:StrictISODateTimeFormat.java   
private static DateTimeFormatter minuteElement() {
    if (mhe == null) {
        return new DateTimeFormatterBuilder()
                .appendLiteral(':')
                .appendFixedSignedDecimal(DateTimeFieldType.minuteOfHour(), 2) // ES change, was .appendMinuteOfHour(2)
                .toFormatter();
    }
    return mhe;
}