monkeytooth Posted October 17, 2010 Share Posted October 17, 2010 Maybe its cause I am just that tired and burnt out currently.. But I am trying to write a function to display <day>, <month> <day number><suffix>, <year> Example: Sunday, October 17th, 2010 However I seemed to screw myself up somewhere in the process and lost my <month> in the script. <month> is coming up and "undefined" but I can't figure it out, im burnt right now. I need an extra pair of eyes to help me out here, thanks in advance. <script type="text/javascript"> <!-- var d_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var d = new Date(); var curr_day = d.getDay(); var curr_date = d.getDate(); var sup = ""; if (curr_date == 1 || curr_date == 21 || curr_date ==31){sup = "st";} else if (curr_date == 2 || curr_date == 22){sup = "nd";} else if (curr_date == 3 || curr_date == 23){sup = "rd";} else{sup = "th";} var curr_month; var curr_year; if((d.getMonth()+6) > 12){curr_month = d.getMonth()+6;curr_year = d.getFullYear();} else{curr_month = d.getMonth()-6;curr_year = d.getFullYear()+1;} document.write(d_names[curr_day] + ", " + m_names[curr_month] + " " + curr_date + "<SUP>"+ sup + "</SUP>, " + curr_year); //--> </script> Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted October 17, 2010 Author Share Posted October 17, 2010 Well.. never mind.. after chugging a bit of coffee, smoking a cigarette, and coming back to it. I figued out my issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.