cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robby Pelssers <Robby.Pelss...@nxp.com>
Subject RE: 2.1 Cocoon Forms Formatting Date in Flow
Date Mon, 24 Sep 2012 07:00:33 GMT
Hi Peter,

Are you sending the mail from flowscript?  I think the formatting is only used for the form
itself but you will still receive a regular Date object on the server side.  So you probably
need to format it on the server side using plain java.

importClass(Packages.java.text.SimpleDateFormat);

var startDate = get date from form
var df = new SimpleDateFormat("dd/MM/yyyy") ;
var formatted = df.format(startDate);

use the formatted date in your sendmail template

Robby

From: Peter D Sparkes [mailto:peter.d@kitchencharisma.com] 
Sent: Sunday, September 23, 2012 11:15 PM
To: Cocoon users
Subject: 2.1 Cocoon Forms Formatting Date in Flow

In my model I have:

<fd:field id="startdate" required="true">
       <fd:label>Start Date:</fd:label>
        <fd:datatype base="date">
              <fd:convertor type="formatting">
                    <fd:patterns>
                           <fd:pattern>dd/MM/yyyy</fd:pattern>
                      </fd:patterns>
                </fd:convertor>
          </fd:datatype>
 </fd:field>

In my js I have:
function enquiry() {
.....
form.showForm("enquiry-display-pipeline" );
var startdate =model.startdate;
I then put startdate into an email and send it
The received email has the startdate  as eg 
Mon Aug 27 00:00:00 BST 2012
Please, how can I format it as 27/0/2012 or get rid of the 

00:00:00 BST

Thanks 

peter








---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message