Skip to main content
August 4, 2008
Question

Complex CFif feature

  • August 4, 2008
  • 2 replies
  • 344 views
I have a chat feature that I only want to be available between the hours of 8:30 am to 4:30 pm. Right now I have this long cfif statement.
1. Is there an easier way to do this?
2. How can I combine if statements like if it is monday between 8:30 to 4:30 pm?
    This topic has been closed for replies.

    2 replies

    Inspiring
    August 4, 2008
    > SPOILER SPACE

    HAHAHAHAHAHAHAHAHAHAHA

    I like it.

    --
    Adam
    Inspiring
    August 4, 2008
    1) Google 'Boolean Logic' and discover the magic of the 'AND' and 'OR'
    operators.

    2) Take a look at the ColdFusion Function documentation for the list
    functions, especially listFind() and possible listContains() functions.

    3) You may also want to take a look at the date functions as well,
    particularly dateCompare(). I.E. It is important to think that times
    are just a portion of a date-time value.


    SPOILER SPACE
    .

    ..

    ...

    ....

    .....

    ......

    .......

    ........

    .........

    ..........

    <cfif DayOfWeek(tdate) GTE 2 AND DayOfWeek(tdate) LTE 6>
    <!--- ON - day is Monday through Friday --->
    <cfelse>
    <!--- OFF - day is Saturday or Sunday --->
    </cfif>

    I leave it to the OP to work the time of the day into this if statement.