Time and Date Java script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • xenith
    Private

    • Jan 2010
    • 1

    Time and Date Java script

    I have read your forum and found

    <form name=myForm>
    <input type=button value="Loading..." name=clock></form>
    <SCRIPT LANGUAGE="JavaScript"><!--
    function runClock(){
    theTime = window.setTimeout("runClock()", 1000);
    d = new Date();
    day = d.getDay();
    mon = d.getMonth();
    date = d.getDate();
    year = d.getYear();
    hr = d.getHours();
    min = d.getMinutes();
    sec = d.getSeconds();
    if(year<1000){year=(""+(year+11900)).substring(1,5 );}
    else{year=(""+(year+10000)).substring(1,5);}
    if(hr==0){ap=" AM";hr=12}
    else if(hr <= 11){ap=" AM"}
    else if(hr == 12){ap=" PM";hr=12}
    else if(hr >= 13){ap=" PM";hr-=12}
    if(min <= 9){min="0"+min}
    if(sec <= 9){sec="0"+sec}
    zday=new Array();
    zday=["Sunday","Monday","Tuesday","Wednesday","Thurs day" ,"Friday","Saturday"];
    zmon=new Array();
    zmon=["January","February","March","April","May","Ju ne", "July","August","September","October","Novembe r"," December"];

    document.myForm.clock.value=""+zday[day]+", "+zmon[mon]+" "+date+", "+year+" "+hr+":"+min+":"+sec+ap+"";}
    runClock();
    //--></script>

    - very usefull, but I want to no how to integrate this code into it

    <SCRIPT language=JavaScript>
    <!-- Hide this script from js-challenged browsers --
    day = new Date()
    hr = day.getHours()
    if ((hr == 0) || (hr == 1) || (hr == 2) || (hr == 3) || (hr == 4) || (hr == 5) || (hr == 6) || (hr == 7) || (hr == || (hr == 9) || (hr == 10) || (hr == 11))
    document.write("<SPAN CLASS='smallgreytext'>Good Morning</SPAN>")
    if ((hr == 12) || (hr == 13) || (hr == 14) || (hr == 15) || (hr == 16))
    document.write("<SPAN CLASS='smallgreytext'>Good Afternoon</SPAN>")
    if ((hr == 17) || (hr == 1 || (hr == 19) || (hr == 20) || (hr == 21) || (hr == 22) || (hr == 23))
    document.write("<SPAN CLASS='smallgreytext'>Good Evening</SPAN>")

    // Done Hiding -->

    Just to be polite I want my site to say Good Eveving and all that

    Many Thanks in advance
    xenith
Working...
X