if (months == 1)
monthsofdays = 0;
if (months == 2)
monthsofdays = 31;
if (months == 3)
monthsofdays = 59;
if (months == 4)
monthsofdays = 90;
if (months == 5)
monthsofdays = 120;
if (months == 6)
monthsofdays = 151;
if (months == 7)
monthsofdays = 181;
if (months == 8)
monthsofdays = 212;
if (months == 9)
monthsofdays = 243;
if (months == 10)
monthsofdays = 273;
if (months == 11)
monthsofdays = 304;
if (months == 12)
monthsofdays = 334;
if (years % 4 ==0 && years % 100 !=0 || years % 400 ==0 && months >=3)
ofdays = yearsofdays + monthsofdays + days;
else
ofdays = yearsofdays + monthsofdays + days - 1;
if (hours >= 8)
ofminites = ofdays * 24 * 60 + (hours - 8) * 60 + minites;
if (hours < 8)
ofminites = (ofdays - 1) * 24 * 60 + (hours + 16) * 60 + minites;
//calculate resultszx;
rest = ofminites * 60 + seconds;