Normal Topic Date Position in Calendar (Q&A) (Read 986 times)
UPaul42
Junior Member
Members
**
Offline


been a Q&A user/programmer
since version 2.0

Posts: 57
Location: Broad Brook CT
Joined: Jul 23rd, 2003
Date Position in Calendar (Q&A)
Mar 7th, 2011 at 4:14pm
Print Post Print Post  
I'm attempting to program for the DOM position. Example: Friday (which one is it 1st, 2nd,...)
I have a database that has dates, Day of Week already established. I need to have a field that shows 1,2,3,4 or 5 as the position that month of that day.
Starting at 03/01/2002 and currently going to 08/31/2034

Date:              DayOfWeek           Pos
filled               filled                     blank (program here)

Having trouble wrapping my head around this.
I'm thinking that if the DayOfMonth is 1 to 7 then Position is 1
if the DayOfMonth is 8 to 14 then Position is 2
if the DayOfMonth is 15 to 21 then Position is 3
if the DayOfMonth is 22 to 28 then Position is 4
if the DayOfMonth is greater than  28 then Position is 5

Sound right?
  

&&http://www.lantica.com/images/sespro_badges/sespro3.gif&&Paul Anderson&&President&&Systems-Consulting&&89 Main Street, Broad Brook CT 06016&&(860) 627-5393&&Sales@Systems-Consulting.com
Back to top
IP Logged
 
UPaul42
Junior Member
Members
**
Offline


been a Q&A user/programmer
since version 2.0

Posts: 57
Location: Broad Brook CT
Joined: Jul 23rd, 2003
Re: Date Position in Calendar (Q&A)
Reply #1 - Mar 7th, 2011 at 4:39pm
Print Post Print Post  
Got It!

Date: #10
DayOfWeek:#20=@DOW$(#10)
Pos:#22:

IF (@DOM(#10) >0 AND @DOM(#10) <8) THEN #22 = 1
ELSE
IF (@DOM(#10) >7 AND @DOM(#10) <15) THEN #22 = 2
ELSE
IF (@DOM(#10) >14 AND @DOM(#10) <22) THEN #22 = 3
ELSE
IF (@DOM(#10) >21 AND @DOM(#10) <29)   THEN #22 = 4
ELSE
IF (@DOM(#10) >28) THEN #22 = 5
  

&&http://www.lantica.com/images/sespro_badges/sespro3.gif&&Paul Anderson&&President&&Systems-Consulting&&89 Main Street, Broad Brook CT 06016&&(860) 627-5393&&Sales@Systems-Consulting.com
Back to top
IP Logged