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
keywords: 

AuthorInfo

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 MEDIA.24Moves.com and organizer of the HoustonPhotowalks.com photography club. He and his wife Marty run the AutismHouston.com Support and Playdate group.

-

@ext237

-

@drupaltips

-

Flickr

-

LinkedIn

-

Ports

-

Contact


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/css-cache.inc on line 52