Hi,
I'm creating a survey123 form using survey123connect (3.4 beta) and I need to be able to drill down into seconds as an option for data entry in a time field. As default the user can only select the hours and minutes for a time field and I can't find anyway of changing this. Does anyone know if this is possible?
thanks
Hi,
Seconds capture is not directly supported. It is possible to have a form with:
1) A Time/DateTime question to record information to the minute
2) An integer field to record the seconds
3) A calculate question that adds the first to questions together
- If using a time question (which stores text), use concat() to add it to the time string
- If using a datetime question, add (# of seconds*1000) to the datetime question
Hi,
We were trying to find a way to use the seconds value from a datetime for other use (concatenate into another value) and thought you may find this useful. The simplest method was to use the scripts component accessible in Connect and then added the pulldata functionality to acquire the seconds from the script.
function getSeconds() {
const padL = (nr, len = 2, chr = `0`) => `${nr}`.padStart(2, chr);
var currentDateTime = new Date( now() );
var resultInSeconds=padL(currentDateTime.getSeconds());
return `${resultInSeconds}`;
}
This is really cool -- Do you just add the seconds to the UTC time recorded by Survey123? I'm trying to do a start time/end time field so I can calculate elapsed times, but I'm only getting minutes so I'm going to try to use your script to incorporate seconds.
Hi James,
I'm responding a couple of years later and hoping you're still active here!
I have set the script up, and now I have applied the pull data function to the Calculation field of my 'time' question - is this correct? How do I get the seconds to display now? Or does this need to be a separate question outside of 'time'.
I am using time alone, rather than datetime.
I second FRSadmin's comment - it would be very beneficial to have seconds and milliseconds included in the DateTime question type.
Thanks!