Package org.opennms.core.time
Class YearGuesser
- java.lang.Object
-
- org.opennms.core.time.YearGuesser
-
public class YearGuesser extends Object
-
-
Constructor Summary
Constructors Constructor Description YearGuesser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.time.LocalDateTime
guessYearForDate(java.time.LocalDateTime dateWithoutYear)
static java.time.LocalDateTime
guessYearForDate(java.time.LocalDateTime dateWithoutYear, java.time.LocalDateTime referenceDateTime)
We try to guess the missing year for the given dateWithoutYear by assigning the year which brings the dateWithoutYear closest (smallest time gap) to the referenceDateTime.
-
-
-
Method Detail
-
guessYearForDate
public static java.time.LocalDateTime guessYearForDate(java.time.LocalDateTime dateWithoutYear, java.time.LocalDateTime referenceDateTime)
We try to guess the missing year for the given dateWithoutYear by assigning the year which brings the dateWithoutYear closest (smallest time gap) to the referenceDateTime. Assumptions: - dateTime and referenceDateTime have the same time zone. - dateTime.getYear() == 0 || dateTime.getYear() == 1970, otherwise we won't do anything- Returns:
- the LocalDateTime with the best guessed year
-
guessYearForDate
public static java.time.LocalDateTime guessYearForDate(java.time.LocalDateTime dateWithoutYear)
-
-