I have 3 variables: (1)Date (2) StartTime (3) EndTime I would like to bring them as two variables (1)Date and StartTime (2) Date and EndTime, so that I can create a google calendar event.
As per my understanding, in order to create a google calendar event I need to pass ISO String format for event timings. Can anyone check the below code and help me with the missing piece.
function createEvent(title,Dt,startTime,endTime,col) {
var calendarId = '[email protected]';
Logger.log(Dt); //2016-07-21
Logger.log(startTime); // 11:55 AM
Logger.log(typeof(startTime)); //string
//Help Needed to convert + to ISO
var event = {
summary: title,
start: {
dateTime: startISO
},
end: {
dateTime: endISO
},
colorId: col
};
event = Calendar.Events.insert(event, calendarId);
Logger.log('Event ID: ' + event.getId());