struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Struts Newsgroup (@Basebeans.com) <str...@basebeans.com>
Subject Re: formating
Date Mon, 01 Jul 2002 11:55:01 GMT
Subject: Re: formating
From: "David Bolsover" <david@bolsover.com>
 ===
Hi Matthias

You don't say in what form your Objects store the datevalue but I'm assuming
that you are using java.sql.Date this being the class most easily used for
database update/retrieve methods.

If you access a from a 'struts' page you will get a date displayed in the
form : 2002-07-01

I have solved this display problem by having getDateString() and
setDateString(String date) in my forms (your Object?).  These methods access
the underlying  java.sql.Date field and do appropriate conversion from/to a
more firendly string format.

This should give you the general direction:

  java.sql.Date  sqlDate = new java.sql.Date(System.currentTimeMillis());
  DateFormat df = DateFormat.getDateInstance(java.text.DateFormat.MEDIUM
Locale.GERMAN);
  System.out.println(df.format(sqlDate));

regards
David
david@bolsover.com

<mhanel@lwplus.de> wrote in message
news:mailman.1025510521.19664.struts@basebeans.com...
> I've got a Bean which contains an array of Objects.
> Each of the containing objects has a datevalue.
>
> In the JSP I want to display the date localized.
>
> How do you solve this problem?
> Thanks in advance. Matthias
>
> --------------------------------------------------------------------------
--
> ----------------
> Hanel Matthias
> Fachinformatiker (Anwendungsentwicklung) in Ausbildung
> Logistik World GmbH Fon: +49-841-9014-300
> Marie-Curie-Strasse 6 Fax: +49-841-9014-302
> D- 85055 Ingolstadt    mailto:mhanel@lwplus.de
> --------------------------------------------------------------------------
--
> ----------------
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message