Display name based on date

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Display name based on date

    Hi All, I am trying to put together a cfm page that will display a users name
    based on the day of the week. The user selects a range of dates that they want
    their name on the list, their name should only show Monday thru Friday. is
    there an easy way to accomplish this in CFM?? I hope I made this clear.
    Thanks iin advance

    EdmondsM Guest

  2. Similar Questions and Discussions

    1. get record based on date time
      HI Im creating a site that generates leads. When a lead is generated it will select a broker in the list based on certain criteria. The thing i...
    2. HELP: variable increment based on date
      Koncept <user@unknown.invalid> writes: Try this: (assuming the event happened September 1st) $start = mktime (0,0,0,9,1,2004); $now =...
    3. selecting based on a month in a date
      Hi, Asked this on the mySQL list but it seems to be more of a PHP syntax thing that a mySQL thing. In have the following line in PHP <?php...
    4. Find Files Based off of Date
      Does anyknow know how to get all the files in a directory based off of creation date (this will be in Windows, unfortunately). For example, get...
    5. If statement based on current date
      I tried the code below and after adjusting it to get around some syntax errors I got nothing. It just runs the queries without even considering...
  3. #2

    Default Re: Display name based on date

    you can use the DayOfWeek function eg. #DayOfWeek(now())# which will return a
    number from 1(Sunday) to 7(Saturday) to tell you which day of the week it is.

    There is also a DayOfWeekAsString which will actually return the name of the
    day.

    So you can do a CFIF or CFSWITCH on the days of the week to determine whether
    to show a users name or not.

    HTH

    Zoe


    zoeski80 Guest

  4. #3

    Default Re: Display name based on date

    Hi Zoe, I have gotten that to work since I posted my message using the
    DayOfWeek. What I trying to achieve now is if the user selects 3/1/05 -
    3/31/05, is there a way to list the numbers out as 1 thru 7. It would continue
    to do this until it has reached the total number of days. Thanks in advance.

    EdmondsM Guest

  5. #4

    Default Re: Display name based on date

    Hi EdmondsM

    I am not really sure what you are doing.
    Are you showing a calendar and peoples names are supposed to appear only on
    the days they selected?
    Do you have some sample code that you can post that shows how you're trying to
    show these dates/users.

    Zoe

    zoeski80 Guest

  6. #5

    Default Re: Display name based on date

    It is not really going to be a calendar per say. What is supposed to happen is
    then a doctor come to the page he is going to sign up for on month of service.
    The weekends they are not on call so those dates need to either blank or in the
    future they maybe fill with a weekend on call doc. So it should look
    something like the following.
    Date Day Doc Name 1 some
    doc name 2 another doc name 3 one more doc
    name and so on. So if the doc only selects the first two weeks to be on call
    then 1 - 14. Making since??

    EdmondsM Guest

  7. #6

    Default Re: Display name based on date

    The attached code should give you a heads up.

    Ken

    <cfset NumberOfDays = DateDiff(datepart, startDate, endDate)>
    <cfset loopTo = NumberOfDays - 1>
    <cfloop from="0" to="#loopTo#" index="idx">
    <cfif DayOfWeek(DateAdd("d", idx, startDate) GT 1 And DayOfWeek(DateAdd("d",
    idx, startDate) LT 6>
    Display Name
    </cfif>
    </cfloop>

    The ScareCrow Guest

  8. #7

    Default Re: Display name based on date

    ScareCrow, thanks. With a couple of tweaks I got it to work.
    EdmondsM Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139