Capture Timestamp

This data event uses the Yes/No field to capture the current time (HH:MM:SS) and populates it into a text field.

Example of the data event results

Example of the data event results

ON('change', 'capture_time', function(event) { // The name of the Yes/No field var currentTimeField = 'time'; // The name of your Time text field if (event.value === 'capture') { // Capture the current time in HH:MM:SS format var now = new Date(); var hours = now.getHours().toString().padStart(2, '0'); var minutes = now.getMinutes().toString().padStart(2, '0'); var seconds = now.getSeconds().toString().padStart(2, '0'); var timeString = hours + ':' + minutes + ':' + seconds; // Set the captured time in the Time field SETVALUE(currentTimeField, timeString); } else if (event.value === 'reset') { // Clear the Time field when reset is selected SETVALUE(currentTimeField, '00:00:00'); } });

What’s Next

Set the time field's default value to 00:00:00

    Did this page help you?