List of usage examples for org.joda.time LocalDateTime withYear
public LocalDateTime withYear(int year)
From source file:com.axelor.csv.script.ImportDateTime.java
License:Open Source License
public LocalDateTime updateYear(LocalDateTime dateTime, String year) { if (!Strings.isNullOrEmpty(year)) { Matcher matcher = patternYear.matcher(year); if (matcher.find()) { Integer years = Integer.parseInt(matcher.group()); if (year.startsWith("+")) dateTime = dateTime.plusYears(years); else if (year.startsWith("-")) dateTime = dateTime.minusYears(years); else/*from www . jav a 2s . co m*/ dateTime = dateTime.withYear(years); } } return dateTime; }