Ok. This is wierd. I posted this in the morning - now its 11pm and it only just arrived. Maybe I should have used snail mail!
Ah of course - its Friday. Guess the email server is taking it easy... ;-) -----Original Message----- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, 17 January 2003 11:41 To: Struts Users Mailing List Subject: RE: [OT] Date format Your best bet is to use the static factory methods in the DateFormat class. ie: Locale locale = getLocale(request); //Use struts Action method to get locale dateTimeFormat = ateFormat.getDateTimeInstance( DateFormat.SHORT,DateFormat.SHORT, locale); dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale); timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, locale); Its all in the javadocs you know. :-) <btw> In case you were wondering how the java.util.Date.toString() works, heres its source code: public String toString() { DateFormat formatter = null; if (simpleFormatter != null) { formatter = (DateFormat)simpleFormatter.get(); } if (formatter == null) { /* No cache yet, or cached formatter GC'd */ formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); simpleFormatter = new SoftReference(formatter); } synchronized (formatter) { formatter.setTimeZone(TimeZone.getDefault()); return formatter.format(this); } } </btw> -----Original Message----- From: Suresh Addagalla [mailto:[EMAIL PROTECTED]] Sent: Thursday, 16 January 2003 22:56 To: [EMAIL PROTECTED] Subject: Date format Hi, Please excuse me for the off-topic question, I need this urgently, so posting it. How can I get the current date format? (style: DateFormat.SHORT, locale: Default) I used: SimpleDateFormat formatter = new SimpleDateFormat() ; String format = formatter.toPattern() ; It gives: M/d/yy hh:mm a But what I want is *only* the date part, excluding the time part of it. Thanks, Suresh -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>