I've got the following object in an array[0]:
var arr[0]=
[
{
"startTime": "1300",
"endTime": "1700",
"eventName": "Sleep",
"end_datetime": "20180510M0100",
"start_datetime": "20180509M2300",
},
{
"startTime": "0800",
"endTime": "1200",
"eventName": "Breakfast",
"end_datetime": "20180507M1200",
"start_datetime": "20180507M0800",
},
{
"startTime": "1300",
"endTime": "1400",
"eventName": "Lesson",
"end_datetime": "20180507M1400",
"start_datetime": "20180507M1300",
},
{
"startTime": "1300",
"endTime": "1700",
"eventName": "Ski",
"end_datetime": "20180511M170000",
"start_datetime": "20180511M130000",
}
]
end_datatime is in format yyyymmddMhhmmss(first 4 digits are year, follow by months, days, separator 'M', hours, minutes, and seconds.
I would like to calculate total duration of all the events? (Total of 11 hours which is 2 hours in sleep + 4 hours in breakfast + 1 hour in lesson + 4 hours in ski)