Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Problem with current date field...

Avatar

Level 4

I want to display the current date and time, but when I change the data format in the binding tab to "Date and Time" and assign a pattern that includes date and time, all I get is the current date, NOT the time. TIA!

11 Replies

Avatar

Level 4

To add current date & Time fields in LiveCycle Designer

You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.

Note: When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.

1. In the Object Library palette, click the Standard category and drag a Date/Time Field object onto the form design.

2. In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.

3. Select the Runtime Property option.

4. View the form in the Preview PDF tab.

Hope this helps!

Thanks,

Vipin

Avatar

Level 4

Well, I thought it was correct. What I need the field to do is whenever the form is opened, I need the field to be populated with the time/date it was opened. Using the runtime method changes the time/date every time it's accessed. If I add a "Date/Time Field", change the "Value" to "Calculated - Read Only" and change the "Data Format" in the "Binding" tab to "Date and Time", it doesn't show anything when I preview the PDF. Same goes for if I add a "Current Date" item and change the "Data Format" in the "Binding" tab to "Date and Time". Any ideas?

Avatar

Level 4

In the Object palette, when you will click the Value tab and select "Calculated - Read Only" from the Type list and select the Runtime Property option, binding tab will automatically hide. I'm using Designer 10.0.2.

Avatar

Level 4

I have found 3 more variants. You can write below code on initialize event. It will automatically display the current data & time during the preview

1.   xfa.form.form1.Page1.TextField1.rawValue

= util.printd("dd.mm.yyyy HH:MM", new Date());

2.  xfa.form.form1.Page1.TextField2.rawValue = util.printd("dddd d. mmmm yyyy HH:MM ", new Date());

3.  xfa.form.form1.Page1.TextField3.rawValue = util.printd("date{EEEE, D. MMMM YYYY} time(de){HH:MM:SS Z}", new Date(), true);

Hope this helps,

Vipin

 

Avatar

Level 4

I have tried applying these scripts in the initialize event to all manner of objects, text field objects, date/time objects, numeric objects, current date objects, and it shows nothing. If I could just edit the date/time format of the current date object when it is set to "Runtime Property-Current Date/Time" I MIGHT be able to use it. I really appreciate your help thus far. Would it be possible for you to share a pdf file that you've made where this works so I might disect it? No matter what pattern I specify in the "Field" palette, it shows it's own formatting.

UPDATE: I did go back after trying it a few times to change the value after Page1 to match the name of my field.

UPDATE 2: Here is a link to what I've done. Take a look and let me know what I'm doing wrong, or change it and share it back. Thanks so much for your help!!!

https://www.dropbox.com/s/1so2hcao372k37z/Script%20Examples.pdf

Avatar

Level 4

HA!!!!! I figured out the date/time formatting!!! It's in the xml as a script. I edited the format in the script and VOILA!!!!  Thanks again for all your help!

Avatar

Level 4

It tells me "The document can't be found or you don't have access to it".

Avatar

Level 4

To access the file you should have account on it or do you have any other way to share the file please let me know.

Avatar

Level 4

I log in using my Adobe ID, is that not the same as a Workspace account?