Hi Robby,
Thank you. have implemented your fix and all now working.
I am sending the mail from flowscript
I have spent hour on this not knowing "formatting is only used for the form itself but you will
still receive a regular Date object on the server side "
Peter
On 24/09/2012 08:00, Robby Pelssers wrote:
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:[email protected]]
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: [email protected]
For additional commands, e-mail: [email protected]