Copy link to clipboard
Copied
I've successfully created a static timestamp using the code below, but I've been struggling to get this to only display the current time calculated into HH:MM:ss only. I would greatly appreciate any help or advice this community is able to offer.
Custom Calculation Script:
var Text1 = this.getField("Text1").value
var Text2 = this.getField("Text2").value
if((Text1!="")&&(Text2=="")) event.value = Date(Date.now());
else if((Text1!="")&&(Text2!="")) event.value = Text2;
else event.value = "";
Current Output:
Sun Apr 24 2022 12:36:13 GMT-0500 (Central Standard Time)
Desired Output:
12:36:13
Use this:
event.value = util.printd("HH:MM:ss", new Date());
Copy link to clipboard
Copied
Use this:
event.value = util.printd("HH:MM:ss", new Date());
Copy link to clipboard
Copied
Oh my God, thank you! I thought the util.printd code was only for printing, but that worked perfectly for was I need!
Copy link to clipboard
Copied
In the olden days of computer programming "printing" was used to mean displaying text, mostly on the screen, and that carried through to now, even though most people would understand it to mean printing to actual paper. I can see how that can be confusing...