How to get current Century from a date in Java?
For example the date \"06/03/2011\" according to format \"MM/dd/yyyy\". How can I get curre
\"06/03/2011\"
\"MM/dd/yyyy\"
Date date = new SimpleDateFormat("MM/dd/yyyy").parse(yourString); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int century = (calendar.get(Calendar.YEAR) / 100) +1;