Status Date Time
1 2016-03-16 8:00:00
0 2016-03-16 12:00:00
1 2016-03-16 16:00:00
0 2016-03-16 20:00:00
1 2016-03-16 23:55:00
0 2016-03-17 01:16:00
1 2016-03-17 02:20:00
0 2016-03-17 04:00:00
1 2016-03-17 08:00:00
0 2016-03-17 12:00:00
1 2016-03-17 04:00:00
0 2016-03-17 06:00:00
I am having above mentioned table.All I want to do is I want calculate the difference between the time where status is changing Eg In first two columns it should return time diff of 4 hrs Then i dont want to calculate the difference between 2nd and 3rd column i want to calculate the difference between 3rd and 4th column and so on....... The time difference should be in time format like 4 hrs or 58 minutes like that overall when there is change in status from 1 to 0 I will calculate the difference Please help.