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
Yup, this is in fact what's happening. See also the Javadoc:
Returns: the year represented by this date, minus 1900.
The getYear method is deprecated for this reason. So, don't use it.
Note also that getMonth returns a number between 0 and 11. Therefore, this.sale.getSaleDate().getMonth()
returns 1 for February, instead of 2. While java.util.Calendar
doesn't add 1900 to all years, it does suffer from the off-by-one-month problem.
You're much better off using JodaTime.