Assuming you are using JSP or some other view technology that supports
jstl tags, take a look at the jstl fmt tag library:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL6.html

In addition to internationalizing messages, it also contains tags to
format numbers and dates according to your locale.  To help get you
started, here is a quick example:

<[EMAIL PROTECTED]  uri="http://java.sun.com/jsp/jstl/fmt"; prefix="fmt"%>
<%
// This would be the date coming from your servlet
request.setAttribute("now", new java.util.Date());
%>
<fmt:formatDate value="${now}" dateStyle="long"/>

This would output the long style date in whatever locale you are using
in your application, e.g. March 29, 2006 for US-English, 29 de marzo
de 2006 for Spanish.

You could use <fmt:setLocale value="es"/> at the outset of that page
to set a generic Spanish locale on that page only, but you probably
already are using some form of localization in other parts of your
application, and you would be better served getting the Locale from
there.  There are also more formatting options than just "long" -- you
can find the javadoc-style tag library documentation at:

http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

-Greg


On 3/29/06, Bart Busschots <[EMAIL PROTECTED]> wrote:
> You can calculate the date in your struts action, stick it into the
> request and then print it out using the bean tags in your JSP.
>
> Dates in Java are a bit mad but basically you need to set up a calendar
> object and give it a spanish locale and then export it to a String.
>
> Have a look at java.util.Calendar in the Java API.
>
> Bart.
>
> Yariel Ramos Moreno wrote:
>
> >Hello:
> >
> >It is possible to get the system date and time using struts (I have seen 
> >DateTime taglib) but show it in Spanish instead of English???
> >
> >Thanks in advance,
> >
> >Yariel.
> >__________________________________________
> >
> >XIII Convención Científica de Ingeniería y Arquitectura
> >28/noviembre al 1/diciembre de 2006
> >Cujae, Ciudad de la Habana, Cuba
> >http://www.cujae.edu.cu/eventos/convencion
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to