Skip to main content
Inspiring
April 21, 2008
Answered

Loop through 24 clock

  • April 21, 2008
  • 1 reply
  • 598 views
Hi Folks,

Can anyone help me loop through the 24hr clock, as intervals of 15 minutes?

I'm designing a calendar and I need to assign events at 15 inute intervals.

Thankyou
    This topic has been closed for replies.
    Correct answer CRidgway
    How are the events stored? Are they all visible in myarray?

    Looking at your code, you step through the hours, but never check anything but the 3rd and 4th sub-element of the last element of the 2D array myarray (ie. myarray[ ArrayLen(myarray)][3] and myarray[ ArrayLen(myarray)][4]).

    Also, is there only one event possible for each 15 minute interval?

    CR

    1 reply

    Inspiring
    April 21, 2008
    Use either 2 or 3 drop down boxes.

    Hour -> 00 - 23 (or 1 - 12)
    Minutes -> 00, 15, 30, 45
    AM/PM -> AM, PM (if you used the 12 hour drop down)

    They only have the option of selecting a 15 minute interval no matter what they select and your drop down will not be 100's of options.

    CR
    MattasticAuthor
    Inspiring
    April 21, 2008
    Thanks for the reply.

    Its for displaying the slots booked in a table, I can loop through the hours easily enough, Its the15 minutes intervals I'm stuck with.


    <cfloop from="0" to="23" index="i">
    <cfset indexdate = createDatetime(year(currentdate), month(currentdate), day(currentdate),i,0,0)>
    <tr>
    <td>#i#</td>
    <td>
    <cfif (myarray[ArrayLen(myarray)][3] lte indexdate and myarray[ArrayLen(myarray)][4] gte indexdate><h3>booked</h3>
    </cfif></td>
    </tr>
    </cfloop>
    CRidgwayCorrect answer
    Inspiring
    April 21, 2008
    How are the events stored? Are they all visible in myarray?

    Looking at your code, you step through the hours, but never check anything but the 3rd and 4th sub-element of the last element of the 2D array myarray (ie. myarray[ ArrayLen(myarray)][3] and myarray[ ArrayLen(myarray)][4]).

    Also, is there only one event possible for each 15 minute interval?

    CR