This script will output the number of days between 2 dates.
var start : DateTime = f(‘Date1‘).toDate();
var end: DateTime = f(‘Date2‘).toDate();
var dayspassed = f(‘Putnumberofdaysdiff‘);
var diff = (end- start).TotalDays;
dayspassed.set(diff);
All the parts in bold will need to be changed to fit your needs, name of the fields mostly.