Y returns 2012 while y returns 2011 in SimpleDateFormat

前端 未结 5 1161
粉色の甜心
粉色の甜心 2020-11-22 01:39

I wonder why \'Y\' returns 2012 while \'y\' returns 2011 in SimpleDateFormat:

System.out.println(new SimpleDateFormat(\"Y\").format(new Date()))         


        
5条回答
  •  清歌不尽
    2020-11-22 02:37

    Format Y to get week year if calendar support week year. (getCalendar().isWeekDateSupported())

提交回复
热议问题