How to get week of the month? Thank you

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

  1. #1

    Default How to get week of the month? Thank you

    I would like to get the week of the month, but I cant found any thing function
    only "week of the year"

    Such as every month we have 4 weeks, i would like to know which week of the
    month.

    Thank you. Your help is very appreciated.

    Dave

    ky_loh Guest

  2. Similar Questions and Discussions

    1. count - day, week, month totals - HOW????
      does anyone know how to do a count for getting totals for today, week, month. Example. i submit a job request form. i need to know running totals...
    2. count for today, week, month totals
      does anyone know how to do a count for getting totals for today, week, month. Example. i submit a job request form. i need to know running totals...
    3. Can I change view from month to week in calendar control ?????
      I want to make a week view and day view just like month view calendar control in .NET. if any one knows how to do that or any one has the source...
    4. ASP.NET: Day / Work Week / Week / Month web calendar control with view like MS Outlook
      Hi!! Did Infragistics or some other company else provide a web calendar conrol with the features and look of Microsoft Outlook calendar? I mean...
    5. to convert a month to previous month
      How to convert a month to previous month in a very easy way? For example, I have AUGUST, but I want JULY to return. Thanks. *** Sent via...
  3. #2

    Default Re: How to get week of the month? Thank you

    i'm afraid it's more complicated than that, it depends i guess on which
    calendar (gregorian, persian, japanese, chinese, islamic) and how you define a
    "week" within a month. for the gregorian calendar, java can have from 0 to 6
    weeks in a month depending on how short the first week is & when the month
    starts(simple example below). if you just want 4 weeks per month no matter what
    then i guess the 2nd example.

    <!--- real week of month --->
    <cfscript>
    calendar=createObject("java","java.util.GregorianC alendar");
    calendar.setTime(now()); //your date goes here
    weekOfMonth=calendar.get(calendar.WEEK_OF_MONTH);
    writeoutput(weekOfMonth);
    </cfscript>

    <!--- 4 weeks per month --->
    <cfscript>
    function weekOfMonth(thisDate) {
    var thisDay=day(thisDate);
    var thisWeek=0;
    if (thisDay LTE 7)
    thisWeek=1;
    else if (thisDay GT 7 AND thisDay LTE 14)
    thisWeek=2;
    else if (thisDay GT 14 AND thisDay LTE 21)
    thisWeek=3;
    else
    thisWeek=4;
    return thisWeek;
    }

    writeoutput(#weekOfMonth(now())#);
    </cfscript>

    PaulH Guest

  4. #3

    Default Re: How to get week of the month? Thank you

    that what i want....billion...thank you so much
    ky_loh 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