Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   IT / Communications (http://www.chiefdelphi.com/forums/forumdisplay.php?f=85)
-   -   Help with calendar (http://www.chiefdelphi.com/forums/showthread.php?t=79875)

~Cory~ 10-01-2010 18:45

Help with calendar
 
For the our website we need a javascript that finds out what day it is, and then writes relevant data. Our times that we meet vary, and it would be a big help!

The part that I most confused with is using the date() function. I know how to get the date, time and the sort, but am lost as to how to make the script do different document.write() according to what day it is.

Thanks!

Also check out the new site! http://arrowheadrobotics.org

DMetalKong 10-01-2010 18:59

Re: Help with calendar
 
First of all, let me point you to the w3schools website. They have a lot of useful tutorials on web-related topics - for your case they have a good date object reference.

Second, you can use the getDay() method along with a switch statement to do what you want. See below

Code:

var d = new Date();
switch(d.getDay()) {
    case 0:
        //do Sunday stuff here
        break;
    case 1:
        //do Monday stuff here
        break;
    //...
    //...
    case 6:
        //do Saturday stuff here
        break;
}

Hope that helps.

~Cory~ 11-01-2010 21:59

Re: Help with calendar
 
ok thanks! ill check out w3c


All times are GMT -5. The time now is 19:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi