Advertise Here

Author Topic: Holiday or normal day finder  (Read 6196 times)

0 Members and 1 Guest are viewing this topic.

Offline DDS

  • SMF For Free Full Member
  • *
  • Posts: 134
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Holiday or normal day finder
« on: March 30, 2008, 07:56:28 am »
This Finds The Current Holiday like easter , christmas.... or if there is no holiday it says good morining , good after noon , good night


Code: [Select]
<html>
<script language="javascript" >
<!-- Begin
Stamp = new Date();
today = new Date();
var Month;
var holidaytest;
var holidaygreeting;


<!-- Valentine's Day //-->
if (((Stamp.getMonth()+1) == 2) && (Stamp.getDate() == 14)){
holidaytest = "yes";
holidaygreeting = "<font color='#cc6699'>H</font>a<font color='#cc6699'>p</font>p<font color='#cc6699'>y</font> V<font color='#cc6699'>a</font>l<font color='#cc6699'>e</font>n<font color='#cc6699'>t</font>i<font color='#cc6699'>n</font>e<font color='#cc6699'>'</font>s <font color='#cc6699'>D</font>a<font color='#cc6699'>y</font>";
}

<!-- St. Patrick's Day //-->
if (((Stamp.getMonth()+1) == 3) && (Stamp.getDate() == 14)){
holidaytest = "yes";
holidaygreeting = "<font color='#99cc99'>Happy St. Patrick's Day</font>";
}


<!--Easter //-->
<!--Check Moon Cycles-->
var currentDate = new Date();
var x = currentDate;
currentDate.setTime(currentDate.getTime() + (currentDate.getTimezoneOffset()*60000));
var blueMoonDate = new Date(96, 1, 3, 16, 15, 0);
var lunarPeriod = 29*(24*3600*1000) + 12*(3600*1000) + 44.05*(60*1000);
var moonPhaseTime = (currentDate.getTime() - blueMoonDate.getTime()) % lunarPeriod;
var time = Math.round((lunarPeriod-moonPhaseTime)/(24*3600*1000));

<!--Is it in March?-->
if ((Stamp.getMonth()+1) == 3) {
if ((Stamp.getDate() > 21) && (20 < time < 30)){
if ((Stamp.getDay() == 5) || (Stamp.getDay() == 6) || (Stamp.getDay() == 0)){
holidaytest = "yes";
holidaygreeting = "Happy Easter";
}
}
}

<!--Is it in April?-->
if ((Stamp.getMonth()+1) == 4) {
if (Stamp.getDate() < 26){
if (20 < time < 30){
if ((Stamp.getDay() == 5) || (Stamp.getDay() == 6) || (Stamp.getDay() == 0)){
holidaytest = "yes";
holidaygreeting = "Happy Easter";
}
}
}
}

<!--Memorial Day //-->
if (((Stamp.getMonth()+1) == 5) && (Stamp.getDate() > 24)){
if ((Stamp.getDay() == 6) || (Stamp.getDay() == 0) || (Stamp.getDay() == 1)){
holidaytest = "yes";
holidaygreeting = "Have a safe and happy holiday";
}
}

<!-- 4th of July //-->
if (((Stamp.getMonth()+1) == 7) && (1 <= Stamp.getDate())){
holidaytest = "yes";
holidaygreeting = "<font color='#cc6699'>H</font>a<font color='#99ccff'>v</font><font color='#cc6699'>e</font> a <font color='#99ccff'>H</font><font color='#cc6699'>a</font>p<font color='#99ccff'>p</font><font color='#cc6699'>y</font> a<font color='#99ccff'>n</font><font color='#cc6699'>d</font> S<font color='#99ccff'>a</font><font color='#cc6699'>f</font>e <font color='#99ccff'>4</font><font color='#cc6699'>t</font>h <font color='#99ccff'>o</font><font color='#cc6699'>f</font> J<font color='#99ccff'>u</font><font color='#cc6699'>l</font>y";
}
if (((Stamp.getMonth()+1) == 7) && (Stamp.getDate() >= 5)){
holidaytest = "no";
}

<!--Labor Day //-->
if (((Stamp.getMonth()+1) == 9) && (Stamp.getDate() < 8)){
if ((Stamp.getDay() == 6) || (Stamp.getDay() == 0) || (Stamp.getDay() == 1)){
holidaytest = "yes";
holidaygreeting = "Have a safe and happy holiday";
}
}

<!-- Halloween //-->
if (((Stamp.getMonth()+1) == 10) && (Stamp.getDate() == 31)){
holidaytest = "yes";
holidaygreeting = "<font color='#ff8c00'>H</font><font color='#000000'>a</font><font color='#ff8c00'>p</font><font color='#000000'>p</font><font color='#ff8c00'>y</font> <font color='#000000'>H</font><font color='#ff8c00'>a</font><font color='#000000'>l</font><font color='#ff8c00'>l</font><font color='#000000'>o</font><font color='#ff8c00'>w</font><font color='#000000'>e</font><font color='#ff8c00'>e</font><font color='#000000'>n</font>";
}

<!-- Thanksgiving //-->
if (((Stamp.getMonth()+1) == 11) && (21 < Stamp.getDate() < 30)){
if (Stamp.getDay() == 4){
holidaytest = "yes";
holidaygreeting = "Happy Thanksgiving";
}
}

<!-- Christmas //-->
if (((Stamp.getMonth()+1) == 12) && (10 <= Stamp.getDate())){
holidaytest = "yes";
holidaygreeting = "<font color='#ff0000'>M</font><font color='#00ff00'>e</font><font color='#ff0000'>r</font><font color='#00ff00'>r</font><font color='#ff0000'>y</font> <font color='#00ff00'>C</font><font color='#ff0000'>h</font><font color='#00ff00'>r</font><font color='#ff0000'>i</font><font color='#00ff00'>s</font><font color='#ff0000'>t</font><font color='#00ff00'>m</font><font color='#ff0000'>a</font><font color='#00ff00'>s</font>";
}
if (((Stamp.getMonth()+1) == 12) && (Stamp.getDate() > 25)){
holidaytest = "no";
}

<!-- New Year //-->
if (((Stamp.getMonth()+1) == 12) && (Stamp.getDate() > 26)){
holidaytest = "yes";
holidaygreeting = "Happy New Year";
}
if (((Stamp.getMonth()+1) == 1) && (Stamp.getDate() < 2)){
holidaytest = "no";
}
if((today.getHours() >=0) && (today.getHours() <=11)){
if (holidaytest == "yes"){
document.write(holidaygreeting);
}
else{
document.write("Good Morning");
}
}
if((today.getHours() >=12) && (today.getHours() <=16)){
if (holidaytest == "yes"){
document.write(holidaygreeting);
}
else{
document.write("Good Afternoon");
}
}
if((today.getHours() >=17) && (today.getHours() <=23)){
if (holidaytest == "yes"){
document.write(holidaygreeting);
}
else{
document.write("Good Evening");
}
}
// End -->
</script>
</html>

Demo: http://holidaytest.smfforfree3.com

Look at the very top

Works With:
Ie 6+
Firefox
Opera
Netscape
And More

Note: I Am a begginer so dont expect anything pro
« Last Edit: March 30, 2008, 08:28:50 am by DDS »

Offline LaundryLady

  • Helpers
  • *
  • Posts: 3253
  • Internet Challenged
    • View Profile

  • Total Badges: 26
    Badges: (View All)
    Seventh year Anniversary Sixth year Anniversary Search Poll Voter Level 5
Re: Holiday or normal day finder
« Reply #1 on: March 30, 2008, 08:43:26 am »
Nice,  looks like a fun thing.


And I Play:  Mafia-Mandemz

Offline DDS

  • SMF For Free Full Member
  • *
  • Posts: 134
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Holiday or normal day finder
« Reply #2 on: March 30, 2008, 08:45:36 am »
Thanks LL ;)

Offline Pancakes

  • SMF For Free Sr. Member
  • *
  • Posts: 467
  • sǝʞɐɔuɐd ǝɯ lol
    • View Profile

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Holiday or normal day finder
« Reply #3 on: March 30, 2008, 08:46:56 am »
it would be nice to make it say it in a differant colour for like each holdiay for christmas maye red and so on

Offline LaundryLady

  • Helpers
  • *
  • Posts: 3253
  • Internet Challenged
    • View Profile

  • Total Badges: 26
    Badges: (View All)
    Seventh year Anniversary Sixth year Anniversary Search Poll Voter Level 5
Re: Holiday or normal day finder
« Reply #4 on: March 30, 2008, 08:48:11 am »
You can do that by changing the font color in it for each special holiday

You can find colors here

http://www.december.com/html/spec/color.html



And I Play:  Mafia-Mandemz

Offline DDS

  • SMF For Free Full Member
  • *
  • Posts: 134
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Holiday or normal day finder
« Reply #5 on: March 30, 2008, 09:01:47 am »
Hehe ty for tellin him

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
17775 Views
Last post October 23, 2007, 02:48:54 pm
by simply sibyl
0 Replies
836 Views
Last post November 15, 2008, 01:42:10 pm
by Sly Fox
8 Replies
2622 Views
Last post January 21, 2009, 07:36:19 am
by SmartBoy986
3 Replies
1551 Views
Last post February 06, 2009, 12:20:13 pm
by simply sibyl
1 Replies
2611 Views
Last post March 16, 2011, 11:56:29 am
by simply sibyl