multiple values

1. Member
Join Date
Dec 1969
Posts
63

## multiple values

I&#039;m created a web-based timesheet. Timesheets are submitted the last day of every month. I want to automate the end date on the timesheet. Obviously, all the months do not have 31 days. So, I&#039;m trying to write a script that says<BR><BR>If the month is 1,3,5,7,8,10 or 12 set the end date equal to 31.<BR>If the month is 4,6,9,11 set the end date equal to 30<BR>otherwise set the end date to 28.<BR><BR>Here&#039;s the code I have so far.<BR><BR>&#060;%<BR>periodend=Month(Now)<BR> if (periodend=[1,3,5,7,8,10,12]) then<BR> enddate=31<BR> else if(periodend=[4 6 9 11]) then<BR> enddate=30<BR> else <BR> enddate=28 <BR> <BR> end if<BR> end if<BR>end if<BR>%&#062;<BR><BR>I can&#039;t figure out the proper syntax for comparing periodend to multiple values.

2. Senior Member
Join Date
Dec 1969
Posts
972

## RE: multiple values

use the select case statement:<BR><BR>SELECT CASE periodend<BR> CASE 1, 3, 5, 7, 8, 10, 12<BR> enddate=31<BR> CASE 4, 6, 9, 11<BR> enddate=30<BR> CASE ELSE<BR> enddate=38<BR>END SELECT

3. el
Member
Join Date
Dec 1969
Posts
70

## RE: multiple values

Can you clarify what multiple values you want to compare?

4. Junior Member
Join Date
Dec 1969
Posts
17

## RE: multiple values

I am sorry I dont have the code but for situations like this I always use the us datediff function subtracting one day from the first day of the next month. This way you will eliminate all the if&#039;s or using a case statment...

5. Member
Join Date
Dec 1969
Posts
63

## It Works. Thanks!

It works. Thanks!

#### Posting Permissions

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