// one shortcut: with our custom format, can simplify handling a bit
if (df.getClass() == StdDateFormat.class) {
df = ((StdDateFormat) df).withTimeZone(tz);
} else {
// otherwise need to clone, re-set timezone:
df = (DateFormat) df.clone();
df.setTimeZone(tz);
}
return withDateFormat(df, pattern);
}
}