Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Print Date and Time

Avatar

Former Community Member
The server with the PDF samples is down, so I was wondering if anyone out there can advise me on resolving a problem. When the end user prints the form to hardcopy, I'd like the system date and time (from the system clock) printed in the footer of the form - similarly as handled in MS Word.

In LiveCycle Designer 7.1, there is a custom field named [Current Date] which is half of my needs, but I can't figure out how to do Current Time. Any ideas?
3 Replies

Avatar

Former Community Member
You could place a text field on the form, remove its caption using the Layout palette (select
None in the Position property at the bottom) and, in its PrePrint event, set the following JavaScript:



var oNow = new Date();

this.rawValue = (oNow.getMonth() + 1) + "/" + oNow.getDate() + "/" + oNow.getFullYear() +

" @ " + oNow.getHours() + ":" + oNow.getMinutes() + ":" + oNow.getSeconds();


This will display the current date and time in "MM/DD/YYYY @ HH:MM:SS" format in the field at the time the user prints the form.



Stefan

Adobe Systems

Avatar

Level 10
Stu,



I liked Stefan's solution that I added another text field over the date field, whose (FormCalc) calculation looked like this:



if (PrintDate == null)

then $ = ""

else $ = "Printed at:"

endif



This meant that the "Printed at" text only appeared when the date was printed on the output and not on the screen.



I realise that this is probably not particularly pretty and that it may be possible to incorporate the "Printed at" in Stefan's Javascript or by having it as a PrePrint event rather than a calculated event.



Have fun!!!



Niall

Avatar

Former Community Member
An even shorter syntax that works in Formcalc for a textfield is:



P1.Printed_on=concat("Printed on: ", Num2Date(date(), "MM/DD/YYYY "), Num2Time(time(), "hh:MM A"))