Example usage for org.joda.time ReadableDateTime getYear

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

Introduction

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

Prototype

int getYear();

Source Link

Document

Get the year field value.

Usage

From source file:com.fusesource.examples.horo.model.StarSign.java

License:Apache License

public boolean appliesTo(ReadableDateTime dateTime) {
    Validate.notNull(dateTime);/*www.  j  av a2  s .c om*/
    int year = dateTime.getYear();

    Interval signInterval = new Interval(start.toLocalDate(year).toDateMidnight(),
            end.toLocalDate(year).toDateMidnight().plusDays(1));
    return signInterval.contains(dateTime);
}

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

License:Apache License

static DateValue dateTimeToDateValue(ReadableDateTime dt) {
    return new DateTimeValueImpl(dt.getYear(), dt.getMonthOfYear(), dt.getDayOfMonth(), dt.getHourOfDay(),
            dt.getMinuteOfHour(), dt.getSecondOfMinute());
}

From source file:com.tmathmeyer.sentinel.ui.views.month.MonthCalendar.java

License:Open Source License

public boolean isToday(ReadableDateTime fom) {
    DateTime now = DateTime.now();//from  w ww.j  a  v a2  s .c  o m
    return fom.getYear() == now.getYear() && fom.getDayOfYear() == now.getDayOfYear();
}

From source file:org.opentestsystem.delivery.testreg.domain.InvalidFormatBasedDateTimeDeserializer.java

License:Open Source License

public DateTime deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    try {//  www .j a  va  2s  .  c om
        ReadableDateTime dateTime = dateTimeDeSerializer.deserialize(jp, ctxt);
        if (dateTime != null) {
            //check if year is 4 digits
            if (String.valueOf(dateTime.getYear()).length() != 4) {
                throw new IllegalArgumentException();
            }
            return dateTime.toDateTime();
        }
        return null;

    } catch (IllegalFieldValueException exception) {
        throw convertToInvalidFormatException(exception);

    } catch (IllegalArgumentException exception) {
        throw new InvalidFormatException("date", jp.getText(), DateTime.class);

    }
}

From source file:org.springframework.analytics.metrics.redis.RedisAggregateCounterRepository.java

License:Apache License

private long[] getMinCountsForHour(String name, ReadableDateTime dateTime) {
    return getMinCountsForHour(name, dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(),
            dateTime.getHourOfDay());//from   w w w .  ja v  a2  s  .c om
}