db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Hawtin <tackl...@claranet.com>
Subject Re: Date formatting with Network Server
Date Sun, 16 Jan 2005 20:49:53 GMT
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

Mime
View raw message