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

calculate date-time difference

  • Jan 27, 2020 6:07 PM UTC
  • 1 reply
  • 122 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 ●●
  • Jan 30, 2020 12:41 PM UTC
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;`