I am using Oracle java 1.7.0_45 and it appears that SimpleDateFormat.format method returns 2015 for the year component instead of 2014.
Here is the unit test:
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("YYYYMMdd");
public static void main(String[] args) {
Date today = new Date();
System.out.println("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
System.out.println("Java Vendor: " + System.getProperty("java.vendor"));
System.out.println("Java Version: " + System.getProperty("java.version"));
System.out.println("Today: " + today.toString() + " formatted: " + DATE_FORMAT.format(today));
}
}
And here is the output from the unit test: OS: Mac OS X 10.10.1 Java Vendor: Oracle Corporation Java Version: 1.7.0_45 Today: Mon Dec 29 09:43:00 EST 2014 formatted: 20151229