Continuing on from my last entry...the first thing I do in this section of the code is set the time.  I do that by using my lessthanten() function and calling the schedule variable as I did last time.  I use this method to create the hour, minutes, and seconds variables.  Then I create newtime which is simply the end time of the soccer game.  To do that I add 3,000,000 milliseconds, basically 50 minutes, which I then adjust with Date() to change my time in milliseconds to something more manageable.

function createics (schedule) { ….

 //setting time

  var hour = lessthanten(schedule[i].datetime.getHours());

  var minutes = lessthanten(schedule[i].datetime.getMinutes());

  var seconds = lessthanten(schedule[i].datetime.getSeconds());

  var newtime = schedule[i].datetime.getTime() + (50*60*1000);

  newtime = new Date(newtime);

  var endhour = lessthanten(newtime.getHours());

  var endminutes = lessthanten(newtime.getMinutes());

  var dtstart = "DTSTART:" + basicdate + "T" + hour + minutes + seconds;

  var dtend = "DTEND:" + basicdate + "T" + endhour + endminutes + seconds;

  ...//Other strings

   }

finalics += "END:VCALENDAR";

return finalics

};


Then I set the endhour and endminutes.  Like with the date (discussed in my last entry), I simply concatenate the items together to get my DTSTART and DTEND times.  This is a basic abbreviation where DTSTART is date/time start and respectively DTEND is date/time end.  The format for date and time entry for ics files is the date, followed by a T to indicate time and then the time.  So I grab my basicdate that created last entry, tack it on to the beginning of these variables, input a T for time, and then concatenate the rest of the information on the end.

Up Next Time: End of ics file creation