Java LocalDate Calculate normalizedYear(LocalDate d)

Here you can find the source of normalizedYear(LocalDate d)

Description

normalized Year

License

Apache License

Return

the year this work was published. May be null

Declaration

private static String normalizedYear(LocalDate d) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.time.LocalDate;

public class Main {
    /** @return the year this work was published. May be null */
    private static String normalizedYear(LocalDate d) {
        if (d == null)
            return null;

        // correct for year-dates that were offset due to UTC conversion to Dec 31st.
        // HACK: should be pushed closer to data source and/or removed once data is updated
        int yr = d.getYear();
        int mo = d.getMonthValue();
        int day = d.getDayOfMonth();
        if (mo == 12 && day == 31) {
            yr++; // assume that what was meant as just a year
        }/*ww  w . java2s. c  om*/

        return String.valueOf(yr);
    }
}

Related

  1. max(ChronoLocalDate date1, ChronoLocalDate date2)
  2. medTime(LocalDate date, String text)
  3. minusDaysAdjustedToStartOfDay(LocalDate ld, int days)
  4. newToOld(LocalDate d)
  5. next(Predicate p)
  6. obtenirLocalDateAPartirDUneDate(Date date)
  7. oneDayAfterNotificationRequired(LocalDate requestDate, LocalDate vehicleDetailsMotExpiryDate)
  8. parseDate(LocalDate date)
  9. period(LocalDate startDate, LocalDate endDate)