Home      Ask a Question      My Stuff      Help   
  
Scripting - Days
Question
ID
109
Category
>Support
  Scripting
Date Created
2/26/2007 2:58:23 PM
Date Updated
12/1/2015 2:05:03 PM
Can you script for a specific day of the week?
Answer
Yes you can script for a rule to only happen on specific days of the week.


Here is an example:

if ("U" contains weekday (punchdate))
{
category = "Sunday";
}


Here are what the days of the week are set to be:

M- Monday
T- Tuesday
W- Wednesday
R- Thursday
F- Friday
S- Saturday
U- Sunday



You can combine them like this:

if("MTWRF" contains weekday(punchdate))
{
whatever;
}

This would apply what ever condition or rule to Monday through Friday.

Another example would be if there is a rate change for a particular day. In this example we will use Thursday and state that if it is Thursday they get time and a half (1.5) for any hours worked that day:

if ("R" contains weekday (punchdate))
{
payrate = payrate * 1.5;
}

Another is maybe to change the category like:

if ("SU" contains weekday (punchdate))
{
category = "Weekend Shift";
}

the above looks for any punches on Saturday (S) or Sunday (U) and if there are any then change the category to "Weekend Shift".

Back to Search Results