[opencms-dev] Show an OpenCmsDateTime element

Borja Marcos Suarez borja.suarez at fundacionctic.org
Fri Jun 10 18:46:45 CEST 2005


Hi Carol,
 
David saved the best trick and didn't tell you everything ;)
 
If you want to write the dateElemente as a date and not as a long you can write:
 
--------- [in the file you have the contentload] --------------
<cms:include file="utils/date.jsp">
    <cms:param name="f">
       <cms:contentshow element="dateTypeElement" />
    </cms:param>
</cms:include>
----------------------------------------------------------
 
Then in the date.jsp you can write the following code:
 
> <%@ page import="java.util.*" %>
>
> <%   
>       Map params=request.getParameterMap();
>      
>       if(params != null){    
>               String[] a_Fecha=(String[])params.get("f");
>               long l_fecha=(a_Fecha!=null?Long.parseLong(a_Fecha[0]):0L);
>
>               if(l_fecha != 0){
>                       Date fecha=new Date(l_fecha);
>                      
>                       java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yy");
>                       out.print(format.format(fecha));
>               }
>       }

 
This is a easy way but I'm sure there are more. If someone knows a more efficient way please tell us :)
 
Hope this help you.
 
best regards,
 
Borja

________________________________

De: opencms-dev-bounces at opencms.org en nombre de Carol Mancho Lagunas
Enviado el: vie 10/06/2005 14:17
Para: The OpenCms mailing list
Asunto: RE: [opencms-dev] Show an OpenCmsDateTime element



Hi, David

una preguntita! cuando haces:
String[] a_Fecha=(String[])params.get("f");

La "f" seria el nombre del elemento de tipo openCmsDateTime?
Yo lo he interpretado asi, pero no me funciona!

Gracias!

El jue, 09-06-2005 a las 12:07 +0200, David García González escribió:
> Hi Carol,
>
> You could try something like:
>
> <%@ page import="java.util.*" %>
>
> <%   
>       Map params=request.getParameterMap();
>      
>       if(params != null){    
>               String[] a_Fecha=(String[])params.get("f");
>               long l_fecha=(a_Fecha!=null?Long.parseLong(a_Fecha[0]):0L);
>
>               if(l_fecha != 0){
>                       Date fecha=new Date(l_fecha);
>                      
>                       java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yy");
>                       out.print(format.format(fecha));
>               }
>       }
> %>
>
> "1118377860000"
> -----Mensaje original-----
> De: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] En nombre de Carol Mancho Lagunas
> Enviado el: jueves, 09 de junio de 2005 9:45
> Para: opencms-dev at opencms.org
> Asunto: [opencms-dev] Show an OpenCmsDateTime element
>
> Hi all,
>
> It's possible to show an OpenCmsDateTime with tag <cms:contentshow..>?
>
> I have created a xmlcontent Schema with an OpenCmsDateTime element, but
> if I show this Date in a jsp with:
>
> <cms:contentshow element="Date" />
>
> it appears like this: "1118377860000"
> 
> How can I make it look like a real date?
>
>
>
>
> Kind regards, Carol
>
>
--
______________________________________________

Carol Manchó Lagunas         carol at asic.udl.es

Campus Virtual
Àrea de sistemes de Informació i Comunicacions
Universitat de Lleida

Pça. Víctor Siurana,1   25003 Lleida
Telèfon: +34 973 702140 / +34 973 702040
______________________________________________






_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 9682 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050610/f47e3a32/attachment.bin>


More information about the opencms-dev mailing list