COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Calculating the 1st Wednesday of each month

• Email
• Follow

```Hi, all:

I would like some advice on how to script a find for all records which
were created after the 1st Wednesday of the current month.

Of course, this group should not include any records created before the
most recent 1st Wednesday.

TIA for any assistance,

Scott
```
 0

See related articles to this posting

```Date(
Month(d_Date1)  , 1 , Year(d_Date1)
) +

Choose(
DayofWeek(
Date(
Month(d_Date1)  , 1 , Year(d_Date1)
)
)-1,
3,2,1,0,6,5,4
)

....should return the first Wednesday of a date field 'd_Date1'. The logic is
to add a calculated numeric value to the first day of the month; that
calculation looks at the value for DayofWeek() of that first day, and, using
Choose(),  adds zero if the day is a Wednesday, 6 for Thursday, and so on.
The '-1' is because Choose() acts like an array, starting at 0, not 1.

You can replace 'd_Date1' with Status(CurrentDate), but remember to leave
the calc unstored. You should be able to use some variation of those calcs
to find dates coming after that first Wednesday.

--
John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Associate Member, Filemaker Solutions Alliance

"Scott Myers" <scott_myers@mac.com> wrote in message
news:scott_myers-80E803.16172327012004@news-central.ash.giganews.com...
> Hi, all:
>
> I would like some advice on how to script a find for all records which
> were created after the 1st Wednesday of the current month.
>
> Of course, this group should not include any records created before the
> most recent 1st Wednesday.
>
> TIA for any assistance,
>
> Scott

```
 0

```Another way...

Enter Find Mode []
Set Field [CreationDate, ">" & DateToText( Status( CurrentDate) - Day(
Status( CurrentDate)) + 1 - (DayofWeek( Status( CurrentDate) - Day(
Status( CurrentDate)) + 1)) + 4 + (7 * (DayofWeek( Status( CurrentDate) -
Day( Status( CurrentDate)) + 1) > 4)))]
Perform Find []

"Scott Myers" <scott_myers@mac.com> wrote in message
news:scott_myers-80E803.16172327012004@news-central.ash.giganews.com...
> Hi, all:
>
> I would like some advice on how to script a find for all records which
> were created after the 1st Wednesday of the current month.
>
> Of course, this group should not include any records created before the
> most recent 1st Wednesday.
>
> TIA for any assistance,
>
> Scott

```
 0

```Not Set Field, I meant Paste Result (or Insert Calculated Result)...sorry.

"Glenn Schwandt" <schwandtg-at@aol-dot.com> wrote in message
news:101fpqfbkktolc7@corp.supernews.com...
> Another way...
>
> Enter Find Mode []
> Set Field [CreationDate, ">" & DateToText( Status( CurrentDate) - Day(
> Status( CurrentDate)) + 1 - (DayofWeek( Status( CurrentDate) - Day(
> Status( CurrentDate)) + 1)) + 4 + (7 * (DayofWeek( Status( CurrentDate) -
> Day( Status( CurrentDate)) + 1) > 4)))]
> Perform Find []
>
> "Scott Myers" <scott_myers@mac.com> wrote in message
> news:scott_myers-80E803.16172327012004@news-central.ash.giganews.com...
> > Hi, all:
> >
> > I would like some advice on how to script a find for all records which
> > were created after the 1st Wednesday of the current month.
> >
> > Of course, this group should not include any records created before the
> > most recent 1st Wednesday.
> >
> > TIA for any assistance,
> >
> > Scott
>
>

```
 0