I am working on a Infoscreen that shows information from a company calendar, but google calendar api gives me dates in toISOString format which looks like: 2015-12-02T14:15:00.000+05:00, how can i reformat it to for example: 12.02.15 14:15?
So it would work together with this code:
function listUpcomingEvents() {
var request = gapi.client.calendar.events.list({
'calendarId': 'MyID',
'timeMin': (new Date()).toISOString(), //If i change format here code doesn't work
'showDeleted': false,
'singleEvents': true,
'maxResults': 1,
'orderBy': 'startTime'
});
request.execute(function(resp) {
var events = resp.items;
appendPre('');
if (events.length > 0) {
for (i = 0; i < events.length; i++) {
var event = events[i];
var when = event.start.dateTime;
if (!when) {
when = event.start.date;
}
var when2 = event.end.dateTime;
if (!when2) {
when2 = event.end.date;
}
appendPre(' Fra ' + when + ' Til ' + when2 + ' ' + event.summary)
}
} else {
appendPre('No upcoming events found.');
}
});
}