Example usage for org.joda.time LocalDate getYear

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

Introduction

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

Prototype

public int getYear() 

Source Link

Document

Get the year field value.

Usage

From source file:rabbit.ui.internal.decorators.RabbitDecorator.java

License:Apache License

private void decorateDate(LocalDate date, IDecoration decoration) {
    checkDateFields();//from  w  w w  . j  av a  2s.  c  om

    int yearDiff = today.getYear() - date.getYear();
    int dayOfYearDiff = today.getDayOfYear() - date.getDayOfYear();

    if (yearDiff == 0 & dayOfYearDiff == 0) {
        decoration.addSuffix(" [Today]");
    } else if ((yearDiff == 0 & dayOfYearDiff == 1)
            | (yearDiff == 1 & isFirstDayOfYear(today) & isLastDayOfYear(date))) {
        decoration.addSuffix(" [Yesterday]");
    }
}

From source file:uk.ac.ox.oucs.vle.CourseDAOImpl.java

License:Educational Community License

public static LocalDate getPreviousYearBeginning(LocalDate currentDate) {
    int currentCivilYear = currentDate.getYear();
    int previousAcademicYear;

    // If we've started a new civil year and haven't changed the academic year yet, go back one more year.
    if (currentDate.isBefore(FIRST_DAY_OF_ACADEMIC_YEAR.toLocalDate(currentCivilYear))) {
        previousAcademicYear = currentCivilYear - 2;
    } else {//from  ww  w  .  j a v a2 s  .  c o m
        previousAcademicYear = currentCivilYear - 1;
    }

    return FIRST_DAY_OF_ACADEMIC_YEAR.toLocalDate(previousAcademicYear);
}

From source file:utility.LocalDateSerializer.java

License:Apache License

@Override
public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
        throws IOException {

    //        jsonGenerator.writeStartObject();

    jsonGenerator.writeString(String.join("-", String.valueOf(localDate.getYear()),
            String.valueOf(localDate.getMonthOfYear()), String.valueOf(localDate.getDayOfMonth())));
    //        jsonGenerator.writeEndObject();
}

From source file:view.ConfigInternalFrame.java

/**
 * Creates new form configInternalFrame//  www. j av  a  2 s  . com
 */
public ConfigInternalFrame() {
    initComponents();

    salvarBtn.setEnabled(false);

    bkpDiario.setSelected(ConfigController.isSetAutoBackup());

    String last_backup = ConfigController.getLastBackupDate();
    backupLabel.setText(last_backup);
    backupLabel.setFont(new Font("Dialog", Font.BOLD, 16));

    int prazo_default = ConfigController.getPrazoDefault();
    prazoField.setText(String.valueOf(prazo_default));

    Double valor = ConfigController.getAppConfigTaxaJuros();
    String s = String.format("%1$,.2f", valor);
    //String s = NumberFormat.getCurrencyInstance().format(valor);
    taxaField.setText("" + s);

    LocalDate date = new LocalDate(System.currentTimeMillis());
    footer.setText(date.getYear() + " - Gabriel Dewes - JBiblioteca ");
}