Example usage for org.joda.time ReadableDateTime toDateTime

List of usage examples for org.joda.time ReadableDateTime toDateTime

Introduction

In this page you can find the example usage for org.joda.time ReadableDateTime toDateTime.

Prototype

DateTime toDateTime();

Source Link

Document

Get this object as a DateTime.

Usage

From source file:com.enonic.cms.core.search.builder.ContentIndexDateValueResolver.java

License:Open Source License

public static Date resolveDateValue(Object value) {
    ReadableDateTime date = doResolveDateValue(value);

    if (date == null) {
        return null;
    }/*  www .j  a v a 2s . c om*/

    return date.toDateTime().toDate();
}

From source file:com.enonic.cms.core.search.ElasticSearchFormatter.java

License:Open Source License

public static String formatDateAsStringIgnoreTimezone(final ReadableDateTime date) {
    return ELASTICSEARCH_SIMPLE_DATE_FORMAT.format(date.toDateTime().toDate());
}

From source file:com.enonic.cms.domain.content.index.translator.expression.CompareExprTranslator.java

License:Open Source License

private String translateValue(ReadableDateTime value, boolean isTyped) {
    return isTyped ? ValueConverter.toTypedString(value.toDateTime().toDate())
            : ValueConverter.toString(value.toDateTime().toDate());
}

From source file:com.facebook.stats.MultiWindowGauge.java

License:Apache License

private GaugeCounter nextCurrentCounter() {
    ReadableDateTime now = new DateTime();
    GaugeCounter gaugeCounter = gaugeCounterFactory.create(now, now.toDateTime().plusSeconds(6));

    allTimeCounter.addEventCounter(gaugeCounter);
    hourCounter.addEventCounter(gaugeCounter);
    tenMinuteCounter.addEventCounter(gaugeCounter);
    minuteCounter.addEventCounter(gaugeCounter);

    return gaugeCounter;
}

From source file:com.facebook.stats.MultiWindowMax.java

License:Apache License

private MaxEventCounter addNewCurrentCounter() {
    ReadableDateTime now = new DateTime();

    MaxEventCounter maxEventCounter = new MaxEventCounter(now, now.toDateTime().plus(COUNTER_GRANULARITY));

    allTimeCounter.addEventCounter(maxEventCounter);
    hourCounter.addEventCounter(maxEventCounter);
    tenMinuteCounter.addEventCounter(maxEventCounter);
    minuteCounter.addEventCounter(maxEventCounter);

    return maxEventCounter;
}

From source file:com.facebook.stats.MultiWindowMin.java

License:Apache License

private MinEventCounter addNewCurrentCounter() {
    ReadableDateTime now = new DateTime();

    MinEventCounter minEventCounter = new MinEventCounter(now, now.toDateTime().plus(COUNTER_GRANULARITY));

    allTimeCounter.addEventCounter(minEventCounter);
    hourCounter.addEventCounter(minEventCounter);
    tenMinuteCounter.addEventCounter(minEventCounter);
    minuteCounter.addEventCounter(minEventCounter);

    return minEventCounter;
}

From source file:com.facebook.stats.MultiWindowRate.java

License:Apache License

MultiWindowRate(CompositeSum allTimeCounter, CompositeSum hourCounter, CompositeSum tenMinuteCounter,
        CompositeSum minuteCounter, ReadableDateTime start, int timeBucketSizeMillis) {
    this.allTimeCounter = allTimeCounter;
    this.hourCounter = hourCounter;
    this.tenMinuteCounter = tenMinuteCounter;
    this.minuteCounter = minuteCounter;
    this.start = start;
    this.timeBucketSizeMillis = timeBucketSizeMillis;
    hourRate = newEventRate(hourCounter, Duration.standardMinutes(60), start);
    tenMinuteRate = newEventRate(tenMinuteCounter, Duration.standardMinutes(10), start);
    minuteRate = newEventRate(minuteCounter, Duration.standardMinutes(1), start);
    currentCounter = nextCurrentCounter(start.toDateTime());
}

From source file:com.facebook.stats.MultiWindowRate.java

License:Apache License

private EventCounterIf<EventCounter> nextCurrentCounter(ReadableDateTime now) {
    EventCounter eventCounter = new EventCounterImpl(now, now.toDateTime().plusMillis(timeBucketSizeMillis));

    allTimeCounter.addEventCounter(eventCounter);
    hourCounter.addEventCounter(eventCounter);
    tenMinuteCounter.addEventCounter(eventCounter);
    minuteCounter.addEventCounter(eventCounter);

    return eventCounter;
}

From source file:com.google.ical.compat.jodatime.DateTimeIteratorFactory.java

License:Apache License

/**
 * given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
 * them into a single date time iterator.
 * @param rdata RRULE, EXRULE, RDATE, and EXDATE lines.
 * @param start the first occurrence of the series.
 * @param tzid the local timezone -- used to interpret start and any dates in
 *   RDATE and EXDATE lines that don't have TZID params.
 * @param strict true if any failure to parse should result in a
 *   ParseException.  false causes bad content lines to be logged and ignored.
 */// ww w .  jav a 2  s .  c o m
public static DateTimeIterator createDateTimeIterator(String rdata, ReadableDateTime start, DateTimeZone tzid,
        boolean strict) throws ParseException {
    return new RecurrenceIteratorWrapper(RecurrenceIteratorFactory.createRecurrenceIterator(rdata,
            dateTimeToDateValue(start.toDateTime().withZone(tzid)), TimeZoneConverter.toTimeZone(tzid),
            strict));
}

From source file:com.google.ical.compat.jodatime.DateTimeIteratorFactory.java

License:Apache License

/**
 * given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
 * them into a single date time iterable.
 * @param rdata RRULE, EXRULE, RDATE, and EXDATE lines.
 * @param start the first occurrence of the series.
 * @param tzid the local timezone -- used to interpret start and any dates in
 *   RDATE and EXDATE lines that don't have TZID params.
 * @param strict true if any failure to parse should result in a
 *   ParseException.  false causes bad content lines to be logged and ignored.
 *///  ww  w .j av  a  2s .com
public static DateTimeIterable createDateTimeIterable(String rdata, ReadableDateTime start, DateTimeZone tzid,
        boolean strict) throws ParseException {
    return new RecurrenceIterableWrapper(RecurrenceIteratorFactory.createRecurrenceIterable(rdata,
            dateTimeToDateValue(start.toDateTime().withZone(tzid)), TimeZoneConverter.toTimeZone(tzid),
            strict));
}