SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Countdown to Last Day of School

    I am a school teacher and also the webmaster of our school website. I am currently in the process of redesigning the website and would like to put a countdown of the number of school days left in the school year at the top of the main page. I have found plenty of scripts that countdown the total number of days, but none that will take into account weekends and school holidays. Our main county webpage, http://www.fcps.net, has exactly what I want on it, but when I contacted our county webmaster, she just cryptically said that it was "an asp script tied to a calendar database" and would not tell me how to do it. Does anyone have any idea of how to do this and whether it is feasible with my limited resources that I have at my fingertips.

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you know how to create an access database and add the events/weekends in between/etc as "events" to a table so an asp script can calculate days based on what's in the database? Also i'm assumng iis is installed on your server since you are the web master - if not why not simply calculate the weekends/ known days off and subtract these days in a javasctipt function? no need to get fancy if you KNOW beforehand how many days are NOT school days. right?

    Brian

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how to do this. That's why I'm asking you all I would still need the database so that the script would know each day whether we were in school or out of school. I understand in my mind how the concept of it works, but I have no clue how to implement it at this point.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you have yahoo chat? if so look up my forum name and i'll explain..I wrote a script that should work for you ;-)

    Brian

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javasript to Calculate school days left w/o need for database

    answer for others if needed...a database is not needed here...

    Code:
    <html>
     <head>
    </head>
    <body>
    
    <SCRIPT LANGUAGE="JavaScript">
    //put this WHERE yu want it to print on screen
    
    
    <!-- Begin
    var date = new Date("May 9, 2005");//put in official last day of school here
    var description = " school days left!";
    var last_day = " Last Day!"
    var now = new Date();
    var diff = date.getTime() - now.getTime();
    var days = Math.floor(diff / (1000 * 60 * 60 * 24));
    var non_school_days = 13 //add weekend AND non school days(holidays) here 
    document.write("<center><h3>")
    if (days > 1) {
    document.write(days + 1 - non_school_days + description);
    }
    else if (days == 1) {
    document.write("Only two days until " + description);
    }
    else if (days == 0) {
    document.write("Tomorrow is " + last_day);
    }
    else {
    document.write(description + "!");
    }
    document.write("</h3></center>");
    // End -->
    </script>
    
    </body>
    </html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •