Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Format Date

Avatar

Former Community Member

Could someone please help me change the display of the date in this form letter? No matter what I do in the "Patterns", it always displays as "2011-12-29". I would like the format to be "12-29-2011".

It is published at:

https://acrobat.com/#d=HvdAt4tEBybI7GlSnqL7cw

Thanks for any help you can offer.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

It is an important concept to get control over, so here is another screenshot:

Parallels Desktop1.png

So for example if you go to the hierarchy and select the hidden date/time field that is associated with the floating field. Then in the Object > Field palette, click Patterns. Then in the Display Pattern, type in OR select the pattern that you want the date to appear in.

Click OK and it should work as you want it.

Good luck,

Niall

View solution in original post

14 Replies

Avatar

Former Community Member

Sorry, it's the Direct Bill Approval Letter pdf.

Avatar

Level 10

Hi,

I can't look at the form at the moment, but is the value of the date object set by script? If so then the script may be setting the display pattern.

If you are using script then replace the format in the script (something like "DateFormat(1)")  to "mm-dd-yyyy".

Hope that helps,

Niall

Avatar

Former Community Member

The date is a relayout from a "screen only" date/time field to a floating field in the body of the letter so that the user can pick the dates of the hotel stay for billing. I used the "patterns" tab for the object to set all to MMMM DD YYYY format and yet when I select a date in the fly out calendar, it displays 2011-12-29. I know they won't be happy with the date in that format.

Thanks for getting back to me. But aren't you supposed to be on Holiday? Us LiveCycle addicts never rest.

Avatar

Level 10

Yes, occupational hazard ;-)

Select the screen only date object and set the data pattern, which is also accessible from the Patterns button in the Object > Field palette.

Set the data pattern to date{mm-dd-yyyy}.

Hope that works!

Niall

Avatar

Former Community Member

Well, when you are able to get to the form and willing to do so, you'll see that I've done that, many times as a matter of fact and yet when I click on a date, it scrambles. I really haven't ever seen it do that before but then this is the first time I've worked with floating fields. I got a very nice example form from Assure's website about floating fields, thank you very much, and took it apart to figure out how to do this with the form letter. I probably messed it up somehow but I trust that you will be able to look at it and immediately figure out what went wrong. I'm hoping.....

Thanks.

Avatar

Level 10

Hi,

I think the date patterns are not working for your floating fields because they are text fields.  If you select the two floating fields and change the Field Type to Date/Time Field (in the Field tab of the Object palette) then the display patterns will be honoured.

Regards

Bruce

Avatar

Former Community Member

Thanks, Bruce, but if you download the form, you will see that they truly are Date/Time fields.

Avatar

Level 10

Hi,

Okay I am back at the desk and Bruce is on the right track. The hidden From and To fields were TextFields. I have corrected this, the display patterns and the data patterns and it works now. Also have a look at the layout suggestions for these fields. Size, reservation and alignment:

https://acrobat.com/#d=Hlv1ARERRlH2YNGf4CG0vQ.

Hope that helps,

Niall

Avatar

Former Community Member

Ok, I'm confused. The "From" and "To" fields are exactly the same Date/Time Fields as the "Date" above. And the pattern for display is set to "April 1, 2007" and yet it displays in what is a better format than the one it originally displayed in of 2012-01-03 but it would be great if it would just display "January 3, 2012" which it's set to do.

Is there something about the xfa.layout.relayout(); that makes it do this? As I said, I don't work with floating fields very often but I'd like to use them more in the future.

Thanks for your help.

Avatar

Level 10

Hi,

Parallels Desktop1.png

The "From" field (yellow and numbered 1) is a Date/Time object with a Display pattern of date{MMMM D, YYYY} and a Data pattern of date{MM-DD-YYYY}. This is a standard object and the user can interact with it as normal.

The Date/Time field associated with the floating field (2) is automatically created by LC Designer and is hidden by default. I have just made it visible for the screenshot. This was originally a TextField and this is why you were having trouble. I changed it to a Date/Time object and set the Display pattern to date{MM-DD-YYYY}. The trick here is that the visible From field AND the hidden floating field have the same name.

The screenshot shows the flow of data. The user selects a From date. When they exit the field a relayout() is fired to force the new date to the hidden date/time field, which in turn pushes it to the visible floating field.

If you want the floating field to display "January 3, 2012" within the text, just change the Display pattern of the hidden From field.

Does that help?

Niall

Avatar

Former Community Member

Well, no because I still can't change the pattern and I don't know what you did to change the display but I guess it will do like it is now. I do appreciate you taking the time to work on it for me. I still can't figure out why the fields would represent themselves as text fields, when I used the Date/Time object from the standard library but I guess I'm happy as long as it's working better. So thanks for all you do on this forum.....

Avatar

Correct answer by
Level 10

Hi,

It is an important concept to get control over, so here is another screenshot:

Parallels Desktop1.png

So for example if you go to the hierarchy and select the hidden date/time field that is associated with the floating field. Then in the Object > Field palette, click Patterns. Then in the Display Pattern, type in OR select the pattern that you want the date to appear in.

Click OK and it should work as you want it.

Good luck,

Niall

Avatar

Former Community Member

Oh, NOW I get it. That screen shot helped so much more. I would have never even known about changing the pattern to the hidden field in the Hierarchy. Yikes. I have so much to learn.

But thank you very much it works now!!!! Whew!!

Avatar

Employee

The video at http://forums.adobe.com/videos/1144  explains , how to format the display of a Date field in the PDF form.