最佳答案
我想知道为什么在 SimpleDateFormat
中,“ Y”返回2012年,而“ y”返回2011年:
System.out.println(new SimpleDateFormat("Y").format(new Date())); // prints 2012
System.out.println(new SimpleDateFormat("y").format(new Date())); // prints 2011
有人能解释一下原因吗?