Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Hani Ibrahim
Added: Aug 15, 2018 2:33 PM
Modified: Aug 15, 2018 9:21 PM
Views: 1
Tags: date year
Return current year as YYYY
  1. /**
  2.      * Return current year as YYYY
  3.      * @return year
  4.      */
  5.     private int getCurrentYear(){
  6.         Calendar cal = Calendar.getInstance();
  7.         cal.setTime(new Date());
  8.         int jahr = cal.get(Calendar.YEAR);
  9.         return jahr;
  10.     }