/    Sign up×
Community /Pin to ProfileBookmark

A/B day alternating

i’m looking at coding myself a calendar. but i wanted to see if there was one thing i could do. and that is have a system where like in the top left corner have there be the date then in the top right have A or B(depending on which day it is). the challenge is that the days alternate. (example: 4/4/04 was an A day, 4/5/04 was a B day, 4/06/04 was an A day, ect….) another challenge that comes up is the weekends. The A/B rotation does apply to the weekend BUT it shouldnt be displayed.

if you didnt pick it up this is for a school schedual thing. The current calendar we have(made by me) is in ASP and VBScript and i couldnt get a A/B rotation to work. here is the [URL=http://sprague.wvi.com/calendarasp/]link[/URL]

if you need to know any more information jus send me an IM, PM, or post on this topic.

Thanks in advance

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@xataku_nakusuteApr 17.2004 — hmm...umm...what rule is the A/B rotation based upon?
Copy linkTweet thisAlerts:
@GenixdeaeauthorApr 17.2004 — not sure what you mean by rule.....

A days are periods 1-4 and B days are periods 5-8. and they rotate.A-B-A-B-A-B, so on so forth.
Copy linkTweet thisAlerts:
@xataku_nakusuteApr 17.2004 — by rule im referring to how you know which day is which

as in, how would you know that today is A, not B or something like that?
Copy linkTweet thisAlerts:
@GenixdeaeauthorApr 17.2004 — the second day of school is an A day and that starts our year. from there they just keep rotating.

here's some situations that occur during the rotation.

Situations::

Weekends:::

friday - A, saturday - b, sunday - a, monday - b

we do not have school on the weekends but that

shows that the rotation applies to determain the

what the following monday is going to be.

3 day weekends:::
same as above with the exception that school
starts on a tuesday and thus an A day.

Holidays:::
Holidays i'm not too sure on how they start......
my best guess is that they start with what ever
day would have come next if we wouldnt of had
a holiday.


Hope that helps, if you need me to tell you thro like msn/aim/yahoo. go ahead and add me.

aim:genixdeae

yahoo:genixdeae

msn:[email protected]
Copy linkTweet thisAlerts:
@GenixdeaeauthorApr 19.2004 — ok, i was able to create a script to Determain wheather or not the days is A or B. i havnt implamented it into any calendar yet but i'll post the function if someone else is looking for it.
[code=php]function ab_ratation(){
$date1 = date("j"); //This gets the current day
$date2 = date("13"); //This is the last day of school
$date = $date1 - $date2; //Subtract the current day from the final day take that number and % 2.
$wkend = date("D"); //This is to keep it from displaying A or B on weekend days
if($date % 2 == 1){
if($wkend == "Sat" || $wkend != "Sun"){
if($wkend != "Sat" || $wkend == "Sun"){
echo "A Day";
}else{
echo "";
}
}
}else{
if($wkend == "Sat" || $wkend != "Sun"){
if($wkend != "Sat" || $wkend == "Sun"){
echo "B Day";
}else{
echo "";
}
}
}
}
[/code]


I found a calendar tutorial and made the calendar and i was going to implement my script but the turorial used mktime() and my function calls for time()......if anyone knows how i could make the two work together let me know please, i can't figure it out.
×

Success!

Help @Genixdeae spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...