FUNCTION GetDifference
(earlierTime$
, moreRecentTime$
) 'returns minutes colonPosition1
= INSTR(earlierTime$
, ":") colonPosition2
= INSTR(moreRecentTime$
, ":") hours1
= VAL(LEFT$(earlierTime$
, colonPosition1
- 1)) hours2
= VAL(LEFT$(moreRecentTime$
, colonPosition2
- 1)) minutes1
= VAL(MID$(earlierTime$
, colonPosition1
+ 1, 2)) minutes2
= VAL(MID$(moreRecentTime$
, colonPosition2
+ 1, 2)) IF MID$(earlierTime$
, colonPosition1
+ 4, 1) = "P" THEN hours1
= hours1
+ 12 IF MID$(earlierTime$
, colonPosition2
+ 4, 1) = "P" THEN hours2
= hours2
+ 12 rightCut1$
= MID$(earlierTime$
, INSTR(earlierTime$
, "/") + 1, LEN(earlierTime$
)) rightcut2$
= MID$(moreRecentTime$
, INSTR(moreRecentTime$
, "/") + 1, LEN(moreRecentTime$
)) year1
= VAL(MID$(rightCut1$
, INSTR(rightCut1$
, "/") + 1, 4)) year2
= VAL(MID$(rightcut2$
, INSTR(rightcut2$
, "/") + 1, 4)) IF hours1
= 24 THEN hours1
= 0 IF hours2
= 24 THEN hours2
= 0 daysInMonth1 = 20
CASE 1, 3, 5, 7, 8, 10, 12 daysInMonth1 = 31
daysInMonth1 = 29
daysInMonth1 = 28
minutesDifferent = 0
currentMinute = minutes1
currentHour = hours1
currentDay = day1
currentMonth = month1
currentYear = year1
minutesDifferent = minutesDifferent + 1
currentMinute = currentMinute + 1
currentMinute = 0
currentHour = currentHour + 1
currentHour = 0
currentDay = currentDay + 1
currentMonth = currentMonth + 1
currentDay = 1
currentYear = currentYear + 1
currentMonth = 1
CASE 1, 3, 5, 7, 8, 10, 12 currentMonth = currentMonth + 1
currentDay = 1
currentYear = currentYear + 1
currentMonth = 1
currentMonth = 3
currentDay = 1
currentMonth = 3
currentDay = 1
currentYear = currentYear + 1
currentMonth = 1
LOOP UNTIL (currentHour
= hours2
AND currentMinute
= minutes2
AND currentMonth
= month2
AND currentDay
= day2
AND currentYear
= year2
) GetDifference = minutesDifferent