Why the current year in the date saved as 3912?

前端 未结 2 1013
梦谈多话
梦谈多话 2021-01-11 19:25

to get the current date and time

final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calend         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-11 19:49

    Better to use Calendar

    Calendar cal=Calendar.getInstance();
    cal.set(Calendar.YEAR,myear);
    

    (i.e)

    cal.set(Calendar.YEAR,2016);
    

提交回复
热议问题