|
-
Dec 10th, 2001, 02:32 PM
#1
Thread Starter
Frenzied Member
Figuring out if number is multiple of 14
I need to know if a number is a multiple of 14. I am dynamicly creating a calendar where I don't know the dates I want to display are at design time. I want to show rows of 14 days. If the user's date range is 2 days then I need to make it 14 if their range is 15 I need to make it 28 (two rows of 14) if it is 30 I need 42, ect.
I think I need to do something like :
Code:
intMod = intVar / 2
intMod = mod(intMod)
if intMod = 0 then
do something
but im not real sure, I havent worked with mod since pascal 
Michael
-
Dec 10th, 2001, 03:01 PM
#2
Frenzied Member
The modulus operator is what you want, but I can't help. I know of no good VB reference. That is my number one complaint with the language.
You can try % to see if it works.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Dec 10th, 2001, 03:06 PM
#3
Frenzied Member
Or, maybe something as bulky as:
VB Code:
intWhichSerie = intCurrIndex Mod 14
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Dec 10th, 2001, 03:23 PM
#4
Addicted Member
Or perhaps the most simple...
way to find out if a number is a multiple of 14 is
if mynumber / 14 = int (mynumber / 14) then
end if
Pigmy
-
Dec 10th, 2001, 03:23 PM
#5
Thread Starter
Frenzied Member
I think I'm going to do it with an if/then tree.
Code:
If datTotal <= 14 Then
datTotal = 14
Else
If datTotal <= 28 Then
datTotal = 28
Else
If datTotal <= 42 Then
datTotal = 42
Else
'alert... you have too many days
End If
End If
End If
Michael
-
Dec 10th, 2001, 03:43 PM
#6
Frenzied Member
Code:
<% @Language="VBScript" %>
<html>
<head></head>
<body>
<%If Request.Form("DayCount") <> "" Then%>
<p>
You should put
<%
If (Request.Form("DayCount") Mod 14) Then
Response.Write(Int(Request.Form("DayCount") / 14 + 1) * 14)
Else
Response.Write(Int(Request.Form("DayCount") / 14) * 14)
End If
%>
days on the calendar.
</p>
<%End If%>
<form action="daycount.asp" method="post">
<input type="text" name="DayCount">
<input type="submit">
</form>
</body>
</html>
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|