Avatar

Level 10

Hi,

this is not too difficult to do in FormCalc.

Use this code in a calculate:Event of a text field or numeric field.

It counts how many mondays this month already has had.

var todaysDate = Date2Num(MyDateField1.formattedValue, "DD.MM.YYYY")

var dayNumber = Num2Date(todaysDate, "D")

var dayCount = 0


for i = dayNumber downto 1 step 1 do

     if (Num2Date(todaysDate - i, "E") eq 2) then

          dayCount = dayCount + 1

     endif

endfor


$ = dayCount