Determine if Day of the Week is during the weekend

#1
Here's a function that I am using to determine if the Day of the Week is during the weekend;
Code:
function weekend=`%@if[%@eval[%1 mod 6] = 1,1,0]`
If I want to see if the current day of the week is on the weekend, I can do;
Code:
echo %@weekend[%_dowi]
which returns 1 if it is the weekend, or 0 if it is not.

Joe
 
#3
Here's a function that I am using to determine if the Day of the Week is during the weekend;
Code:
function weekend=`%@if[%@eval[%1 mod 6] = 1,1,0]`
Shouldn't that be
Code:
function weekend=`%@if[%@eval[%1 mod 6] == 0,1,0]`
As you have it, Monday is the only weekend day!
Code:
v:\> function weekend=`%@if[%@eval[%1 mod 6] = 1,1,0]`

v:\> do i=0 to 6 ( echo %@weekend[%i] )
0
1
0
0
0
0
0
And, I didn't know you could use '=' as a relational operator.
 
#4
On my system,
Code:
TCC  16.00.43  Windows Vista [Version 6.0.6002]
TCC Build 43  Windows Vista Build 6002  Service Pack 2
Sunday = 1, Monday = 2, .... Saturday = 7
Code:
do i=1 to 7 (echo %@weekend[%i] )
1
0
0
0
0
0
1
According to the TCC help, this is the same as _dowi.

As for EQ, hmmm... = works in this and other functions that I have.

Do I have something set in a TCC .INI file that might be allowing me to use = instead of EQ? If I am reading the TCC help correctly, under Conditional Expressions, the equal sign should not work.

Joe
 
#6
Here's how I figure it out...

Am I at work? Yes, so it's not the weekend.

Edit: But seriously, cool function.