Skip to main content
Known Participant
July 24, 2017
Question

Javascript code to capture date and time from windows clock

  • July 24, 2017
  • 1 reply
  • 1400 views

Good afternoon people,

I would like to create a button where a person clicks, appears in a textbox, the date and time of the Windows clock. it is possible?

Best regards

Berg

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 24, 2017

Certainly. Use this code as the button's MouseUp script (adjust the field name and date format, of course):

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

BergLinoAuthor
Known Participant
July 24, 2017

Thanks for the help, I got it.
I am using this code to generate a name in a textbox, based on their respective names. The name that appears to me in the textbox is: GPDS_ContractName_ Date and Time. I use this to generate the default file name for me. I would like to insert below a
Var v1 = "GPDS_" + getField ("CONTRACT NAME"). ValueAsString + "_" + getField ("TIME") valueAsString
Var v2 = v1.replace ("/", "");
Var v3 = v2.replace ("/", "");
Var v4 = v3.replace (":", "");
GetField ("FILE NAME"). Value = v4;

Regards,

Berg

try67
Community Expert
Community Expert
July 24, 2017

Your code contains a lot of mistakes... You should spend some time studying the core JS syntax, before writing any code for Acrobat.