calculate date-time difference | XM Community
Skip to main content
i've seen a few older answers to this question but does anyone have an easy method for calculating the difference between dates using answers (from a date picker) to questions earlier in a survey for either an embedded field or to prepopulate the answer to a single text box entry field?



thanks!
You could use JavaScript. Use something like this with an event trigger such as onLoad, etc.:

`var startDate = new Date();

// Do your operations

var endDate = new Date();

var seconds = (endDate.getTime() - startDate.getTime()) / 1000;`

Leave a Reply