-
-
Save vikaskanani/7036400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfdump var="#TimeSlot(Minutslot = 15)#" /> | |
<cffunction name="TimeSlot" output="false" access="public" returntype="any"> | |
<cfargument name="Minutslot" type="numeric" required="true"> | |
<cfif 1440 MOD arguments.Minutslot NEQ 0> | |
<cfthrow type="user" message="Invalid Minute slot"> | |
</cfif> | |
<cfset var i = 0> | |
<cfset var retArray = arrayNew(1)> | |
<cfset var TotalSlots = 1440 / arguments.Minutslot> | |
<cfset var StartTime = CreateDateTime(2013, 1, 1, 0, 0, 0)> | |
<cfset var EndTime = dateAdd("n", arguments.Minutslot, StartTime)> | |
<cfloop from="1" to="#TotalSlots#" index="i"> | |
<cfset retArray[i] = timeFormat(StartTime, "hh:mm TT") & " To " & timeFormat(EndTime, "hh:mm TT")> | |
<cfset StartTime = EndTime> | |
<cfset EndTime = dateAdd("n", arguments.Minutslot, StartTime)> | |
</cfloop> | |
<cfreturn retArray> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment