You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter D Sparkes <pe...@kitchencharisma.com> on 2012/09/23 23:14:39 UTC
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
Re: 2.1 Cocoon Forms Formatting Date in Flow
Posted by Peter D Sparkes <pe...@kitchencharisma.com>.
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: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
RE: 2.1 Cocoon Forms Formatting Date in Flow
Posted by Robby Pelssers <Ro...@nxp.com>.
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