Understanding the details
Script | Meaning |
---|---|
var oneDay = 1000*60*60*24; | The number of milliseconds in a day |
var startDateVariable = #someStartDate.value; | Object representing the Studytrax variable |
var startDate = startDateVariable.value; | JavaScript Date object |
An example
var startDate = #AEonsetDate.value;
var endDate = #AEendDate.value;
if (!isNull(startDate.value) && !isNull(endDate.value)) {
var AEdays = (endDate - startDate)/oneDay;
}
Output.write("The AE started on " + startDate.toString() + ", and lasted for " + AEdays + " days.");