calculate date-time difference | XM Community
Skip to main content
Question

calculate date-time difference

  • January 27, 2020
  • 1 reply
  • 104 views

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!

1 reply

pogi
Level 2 ●●
Forum|alt.badge.img+14
  • Level 2 ●●
  • 153 replies
  • January 30, 2020
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;`