How to get last month/year in java?
Your solution is here but instead of addition you need to use subtraction c.add(Calendar.MONTH, -1); Then you can call getter on the Calendar to acquire proper fields int month = c.get(Calendar.MONTH) + 1; // beware of month indexing from zero int year = c.get(Calendar.YEAR);