Skip to main content
Participating Frequently
July 19, 2016
Question

Using Timestamp

I am creating a form that behaves like a time clock. I have used the Mouse Up function with a field named Timestamp and it doesn't work. Should I expect this type of function to work with Adobe? I am a novice, but follow directions well. 

This topic is closed to new replies. Start a new post to keep the conversation going.

21 replies

Karl Heinz  Kremer
Community Expert
Community Expert
July 19, 2016

We need a bit more information: What exactly are you doing in your mouse-up action? What is "this type of function"? If you want to learn about time and date support in Acrobat's JavaScript, take a look at this three part tutorial:

https://acrobatusers.com/tutorials/date_time_part1 

Translate
cooler61Author
Participating Frequently
July 19, 2016

I created a form. I added a text box so that the system can generate the

date and time and input the date and time into a the text box with one

click, so employees don't have to use an electronic time stamp machine.

Maybe my hopes are too high for an Adobe app. I copied the following into

the menu that allows me to customize the box (font size, placement, etc:

// Mouse UP script of a button

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

Nothing happened.

I will review the link that you provided, but if Adobe, using Java Script,

can't do what I want, I don't need to go through the tutorial.

Thanks.

Claudia

On Tue, Jul 19, 2016 at 12:10 PM, Karl Heinz Kremer <

Translate
Karl Heinz  Kremer
Community Expert
Community Expert
July 19, 2016

In that case, use the following script, it should fill in the data when the user clicks on the field:

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

However, this will require a few clicks to get the date into the field: You are triggering this off the mouse-up event. This means that you have to click on the field, and then click again outside of the field to actually see the value. It might be easier to have a button that fills in the date and time information (and in that case you can use the script that you've quoted).

Translate