If you are looking for a simpler way of doing this, the following also works:
<%DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.US);%> <mm:field name="timestamp" jspvar="ts" vartype="long" write="false"> <%= df.format(new Date(ts.longValue())) %> </mm:field> ----- Original Message ----- From: "Curtney Jacobs" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 11, 2004 9:34 AM Subject: Re: Community Application - Timestamp field > It works! > > Thanks, > > Curtney > ----- Original Message ----- > From: "Andr� van Toly" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, November 11, 2004 12:00 AM > Subject: Re: Community Application - Timestamp field > > > Hi, > > I believe you should divide the community > timestamp by 1000. It is a Long in milliseconds > since 1970, while other 'timestamps' in MMBase > are seconds since 1970. > > I used the following piece of code although i > must say it doesn't look very elegant: > > <mm:field name="timestamp" jspvar="ts" vartype="String" write="false"> > <% ts_sec = Long.parseLong(ts) / 1000; %> > </mm:field> > <mm:import id="ts"><%= String.valueOf(ts_sec) %></mm:import> > <mm:write referid="ts"><mm:time format="dd MMMM yyyy HH:mm" /></mm:write> > > ---Andr� > > > At 21:21 -0800 10-11-2004, Curtney Jacobs wrote: > >Greetings! > > > >I am using the MMBase Community application and > >I would like posted messages to display the date > >in the following format: > > > > November 10, 2004 > > > >I am using the following code to do this: > > > > > > <mm:field name="timestapsec" > >id="commentdate" write="false"/> > > > > <mm:time > >referid="commentdate" format=":FULL.FULL" > >precision="hours"/> > > > > > > > >However, I keep on getting the same date > >displayed, no matter the day the message was > >posted. > > > > > > > >If I use the following code (that comes with the > >community application) then it works, however it > >does not display the results I want > > > > > > > > <mm:field name="day(timestampsec)" /> > > > > <mm:field name="month(timestampsec)" /> > > > > <mm:field name="year(timestampsec)" /> > > > > > > > > > > > >Any help is grealy appreciated. > > > > > > > >Thanks, > > > >Curtney > > > -- > > ------------------------------------------------------------------>><<-- > Andr� van Toly > http://www.toly.nl > 06-27233562 > > > > >
