| Reference | Downloads | Github

How to show simple Clock time

Hi, everyone.
I am new to the Online Survey and Psychopy Builder.
Now I’m trying to make the stopwatch task, and during the task want to display the time to the second decimal place.
The text component is like the following pic.
I think the problem is sure “%.2f”.
Does anyone know how to change “%.2f” into JS code?
Also, I do not know where I should define the time (Begin Routine? EveryFrame? or In the Text?)

Thank you in advance.

Description of the problem:

Hello Gen.K,

you need to set the text that you want to display in a code-component. Initialize this variable before using it. See wakecarter’s crib sheet for formatting strings in JS (e.g. “msg = str(myVar);” instead of “msg = %s” % myVar" in Python. Set the code-component to both instead of auto for formatting msg.

msg = “%.2f” % trialClock.getTime().
msg = (round(trialClock.getTime(),2).toString())

Best wishes Jens