Once you know this:
- You can create a
Dateby calling the constructor with milliseconds since Jan 1, 1970. - The
valueOf()aDateis the number of milliseconds since Jan 1, 1970 - There are
60,000milliseconds in a minute :-]
In the code below, a new Date is created by subtracting the appropriate number of milliseconds from myEndDateTime:
var MS_PER_MINUTE = 60000;
var myStartDate = new Date(myEndDateTime - durationInMinutes * MS_PER_MINUTE);