I have a date stored as a java.sql.Timestamp in a database. The date is "2010-01-20T19:10:35.000Z" and is equivalent to 1264014635743 ms.
Somehow, the date is formatted differently on the prod machine compared to the dev machine.
The code to format the date is:
private final static String DATE_FORMAT = "yyyy-MM-dd";
public final static SimpleDateFormat APP_DATE_FORMATER = new SimpleDateFormat(DATE_FORMAT);
private static final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("Etc/UTC");
APP_DATE_FORMATER.setTimeZone(UTC_TIMEZONE);
DateTimeZone.setDefault(DateTimeZone.UTC);
String output = APP_DATE_FORMATER.format(date)
The generated output in dev is the correct "2010-01-20". But in prod I have "2010-01-21", one day later!
Of course, since the error occurs on the prod server, I'm limited in my debugging options...
I have double checked, and both server have the same time and timezone. Both clock are synchronized with an ntp server.
[UPDATE] The database in prod has the value: "10-01-20 19:10:35,743000000" for the date field