Formatting Hours and Minutes (Classic ASP)

And another old code segment, this time formatting "Hours" and "Minutes". The trick for the minutes is to return one of the quarter hours. If the minutes evaluate to "0", then "00" will return instead.

Function FormatMinutes(pIndex)
	Dim iMinutes, iIndex
	iIndex = cInt(pIndex)

	' ---- Minutes = the remader of i/4 * 15
	iMinutes = (iIndex mod 4) * 15
	If iMinutes = 0 Then iMinutes = "00"
	FormatMinutes = iMinutes
End Function

Function FormatHours(pIndex,bFilterMilitary)

	Dim iHours, iIndex
	iIndex = cInt(pIndex)

	' ---- Hours = the index divided by the number of quarter-hours:
	iHours = (iIndex/4)
	' ---- Remove Remainders
	If inStr(1,iHours,".") Then iHours = left(iHours,instr(1,iHours,".")-1)
	' ---- Remove military time?
	If bFilterMilitary = True Then _
		If iHours > 12 Then iHours = iHours - 12
	FormatHours = iHours

End Function


Joe is a User Experience Engineer, Front End Specialist and Application Developer for Bridgeway Software, Inc and part-time consultant for NGO and non-profit organizations in the Houston area. Joe is also a part-time Portrait Photographer at and organizer of the photography club. He and his wife Marty run the Support and Playdate group.













Fatal error: Class CToolsCssCache contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (DrupalCacheInterface::__construct) in /home/content/e/x/t/ext237/html/modules/ctools/includes/ on line 52