How to get only year from DateUtils
4 answers
No need to reinvent the wheel
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String year = sdf.format(new Date());
To take the locale into account, use the SimpleDateFormat ("template", Locale) constructor
SimpleDateFormat sdf = new SimpleDateFormat("yyyy", Locale.getDefault());
+3
source to share