Example usage for org.joda.time LocalDateTime getYear

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

Introduction

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

Prototype

public int getYear() 

Source Link

Document

Get the year field value.

Usage

From source file:org.odk.collect.android.fragments.dialogs.BikramSambatDatePickerDialog.java

License:Apache License

private void setUpDatePicker() {
    LocalDateTime localDateTime = getDate();
    try {/*w  ww.j av a 2 s. c  o  m*/
        BikramSambatDate bikramSambatDate = BsCalendar.getInstance().toBik(localDateTime.getYear(),
                localDateTime.getMonthOfYear(), localDateTime.getDayOfMonth());
        setUpDayPicker(bikramSambatDate.day,
                BsCalendar.getInstance().daysInMonth(bikramSambatDate.year, bikramSambatDate.month));
        setUpMonthPicker(bikramSambatDate.month, monthsArray);
        setUpYearPicker(bikramSambatDate.year, MIN_SUPPORTED_YEAR, MAX_SUPPORTED_YEAR);
    } catch (BsException e) {
        Timber.e(e);
    }
}

From source file:org.odk.collect.android.fragments.dialogs.CopticDatePickerDialog.java

License:Apache License

private void setUpDatePicker() {
    LocalDateTime copticDate = DateTimeUtils.skipDaylightSavingGapIfExists(getDate()).toDateTime()
            .withChronology(CopticChronology.getInstance()).toLocalDateTime();
    setUpDayPicker(copticDate.getDayOfMonth(), copticDate.dayOfMonth().getMaximumValue());
    setUpMonthPicker(copticDate.getMonthOfYear(), monthsArray);
    setUpYearPicker(copticDate.getYear(), MIN_SUPPORTED_YEAR, MAX_SUPPORTED_YEAR);
}

From source file:org.odk.collect.android.fragments.dialogs.EthiopianDatePickerDialog.java

License:Apache License

private void setUpDatePicker() {
    LocalDateTime ethiopianDate = DateTimeUtils.skipDaylightSavingGapIfExists(getDate()).toDateTime()
            .withChronology(EthiopicChronology.getInstance()).toLocalDateTime();
    setUpDayPicker(ethiopianDate.getDayOfMonth(), ethiopianDate.dayOfMonth().getMaximumValue());
    setUpMonthPicker(ethiopianDate.getMonthOfYear(), monthsArray);
    setUpYearPicker(ethiopianDate.getYear(), MIN_SUPPORTED_YEAR, MAX_SUPPORTED_YEAR);
}

From source file:org.odk.collect.android.fragments.dialogs.IslamicDatePickerDialog.java

License:Apache License

private void setUpDatePicker() {
    LocalDateTime islamicDate = DateTimeUtils.skipDaylightSavingGapIfExists(getDate()).toDateTime()
            .withChronology(IslamicChronology.getInstance()).toLocalDateTime();
    setUpDayPicker(islamicDate.getDayOfMonth(), islamicDate.dayOfMonth().getMaximumValue());
    setUpMonthPicker(islamicDate.getMonthOfYear(), monthsArray);
    setUpYearPicker(islamicDate.getYear(), MIN_SUPPORTED_YEAR, MAX_SUPPORTED_YEAR);
}

From source file:org.pidome.server.services.macros.Macro.java

License:Apache License

/**
 * Returns the last occurrence of the actions taken.
 * @return /*from  w ww. j  a  va 2  s .co m*/
 */
public final String getLastOccurrence() {
    if (lastOccurrenceTime == 0) {
        return "Never";
    } else {
        DateTime dt = new DateTime(new Date(lastOccurrenceTime));
        LocalDateTime ldt = dt.toLocalDateTime();
        return TimeUtils.compose24Hours(ldt.getHourOfDay(), ldt.getMinuteOfHour()) + " "
                + TimeUtils.composeDDMMYYYYDate(ldt.getDayOfMonth(), ldt.getMonthOfYear(), ldt.getYear());
    }
}

From source file:playground.johannes.gsv.synPop.invermo.Date2TimeTask.java

License:Open Source License

private LocalDateTime getReference(String date) {
    LocalDateTime dateTime = SplitPlanTask.formatter.parseLocalDateTime(date);
    return new LocalDateTime(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), 0, 0);
}

From source file:propel.core.utils.ConversionUtils.java

License:Open Source License

/**
 * Converts a Joda LocalDateTime object to an XML Gregorian Calendar data type
 *///from   w w w .ja v  a  2 s  . c  o  m
@Validate
public static XMLGregorianCalendar toXMLGregorianCalendar(@NotNull final LocalDateTime value)
        throws DatatypeConfigurationException {
    val gc = new GregorianCalendar(value.getYear(), value.getMonthOfYear() - 1, value.getDayOfMonth(),
            value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute());
    gc.set(Calendar.MILLISECOND, value.getMillisOfSecond());

    return DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
}

From source file:qunar.tc.qmq.delay.store.log.ScheduleOffsetResolver.java

License:Apache License

private static long year(final LocalDateTime localDateTime) {
    return localDateTime.getYear() * 100000000L;
}

From source file:siddur.solidtrust.azure.AzureConnector.java

private static Date toDate(LocalDateTime l) {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.YEAR, l.getYear());
    c.set(Calendar.DAY_OF_YEAR, l.getDayOfYear());
    c.set(Calendar.HOUR_OF_DAY, l.getHourOfDay());
    c.set(Calendar.MINUTE, l.getMinuteOfHour());
    c.set(Calendar.SECOND, l.getSecondOfMinute());
    c.set(Calendar.MILLISECOND, l.getMillisOfSecond());
    return c.getTime();
}

From source file:todolist.ui.controllers.SettingsController.java

/**
 * isWithinWeek/*from   w w  w  .ja v a  2s  . c  om*/
 * 
 * @param startOfWeek
 * @param endOfWeek
 * @param endTime
 * @return boolean
 */
private boolean isWithinWeek(LocalDateTime startOfWeek, LocalDateTime endOfWeek,
        java.time.LocalDateTime endTime) {

    int millis = 0;
    int seconds = endTime.getSecond();
    int minutes = endTime.getMinute();
    int hours = endTime.getHour();
    int day = endTime.getDayOfMonth();
    int month = endTime.getMonthValue();
    int year = endTime.getYear();

    LocalDateTime endTimeFormatted = new LocalDateTime();
    endTimeFormatted = endTimeFormatted.withDate(year, month, day);
    endTimeFormatted = endTimeFormatted.withTime(hours, minutes, seconds, millis);

    return endTimeFormatted.isAfter(startOfWeek) && endTimeFormatted.isBefore(endOfWeek);
}