方法一:
public static String getCurrentYear(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); Date date = new Date(); return sdf.format(date); }
方法二:
public static String getSysYear() { Calendar date = Calendar.getInstance(); String year = String.valueOf(date.get(Calendar.YEAR)); return year; }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/14169.html