Java SimpleDateFormat shifts Date by one year [duplicate]
问题 This question already has answers here : Y returns 2012 while y returns 2011 in SimpleDateFormat (4 answers) Closed 4 years ago . I'm getting very weird results, which I can not understand. public class Test { private static DateFormat df = new SimpleDateFormat("dd.MM.YYYY HH:mm"); public static void main(String[] args) { Date d = new Date(1356912000000L); System.out.println(d); System.out.println(df.format(d)); } } Gives the output: Mon Dec 31 01:00:00 CET 2012 31.12.2013 01:00 I assume that