Need help try the write a script with day date and time

Do not know what iam doing wrong and would like some help to fix it i am trying too make script to write out the day date and time like this It is currently: 3:15 PM on Wednesday, September 21. this is what i have

function renderTime(){
var mydate = new date();
var year = mydate.getYear();
    if(year < 1000){
        year +=1900
    }
var day = mydate.getDay();
var month = mydate.getMonth();
var daym = mydate.getDate();
var dayarray = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray = new Array("Jannuary","Februry","March","April","May","June","July","Augest","September","October","November","December");

var currentTime = new Date();
var h = currentTime.getHour();
var m = currentTime.getMinutes();
var ampm = h >= 12 ? 'pm' : 'am';
 if(h == 24){
        h = 0;
    } else if (h > 12 ){
        h = h - 0;
    }
    if(h < 10){
        h = "0" + h;
    }
    if(m < 10){
        m = "0" + m;
    }

}

document.write("It is currently"+h+m+"on"+dayarray[day]+ montharray[month]+daym);

17 thoughts on “Need help try the write a script with day date and time”

Leave a Comment