Army wrote:

2) If the answer to #1 is "Yes", then is it safe to replace the "writeString" call above with the following?


    SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");
    writer.writeString(df.format((java.sql.Date) val));

Or is there some reason why we need to avoid using SimpleDateFormat?

Two reasons not to write it exactly like that:

o SimpleDateFormat is locale dependent. A fixed Locale should be set. Far too much picks up the default locale, and other globals.

 o It's not exactly fast to create a new date formatter every time.

Tom Hawtin

Reply via email to