I am having the following problem in Java (I see some people are having a similar problem in JavaScript but I\'m using Java)
System.out.println(new Date().ge
Java 8 LocalDate class is another option to get the year from a java.util.Date,
int year = LocalDate.parse(new SimpleDateFormat("yyyy-MM-dd").format(date)).getYear();
Another option is,
int year = Integer.parseInt(new SimpleDateFormat("yyyy").format(date));