Jump to content

Dogberry

Members
  • Posts

    4
  • Joined

  • Last visited

Dogberry's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks for the replies and yes I am very new to this. I do not fully understand the replies but at least you have given me some more research to do in the right paths much obliged. Chris
  2. var today_obj = new Date();var today_date = today_obj.getDate();var tips;tips = []; Thereafter I have 31 tips one for each day of the month. The script ends with document.write(tips[today_date]); Both JSLint and JSHint are giving me grief over the document write statement. Can anyone give me an alternative that will keep these two beasts happy and still give me what I want. Many thanks for your time and efforts in advance. Chris
  3. Thanks for the feedback folks problem now solved and date is showing correctly thanks to Hadien, guess in my learning curve I was trying to make life difficult for myself Chris
  4. Hi Folks hope you can help I am trying to add the date to a website in the format Sunday the 11th of May 2014 all I am getting is Sunday the 11 May 2014. I am very new at this so could you explain in plain terms. I think the problem is from var nth onwards. Many thanks for your help. Chris var dayName;dayName = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];var monName;monName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];var now;now = new Date();var stamp;stamp = new Date();var today;today = stamp.getDate();var theDate = now.getDate();var nth = '';if (theDate > 3 && theDate < 21) // catch teens, which are all 'th' nth = theDate + 'th';else if (theDate % 10 == 1) // exceptions ending in '1' nth = theDate + 'st';else if (theDate % 10 == 2) // exceptions ending in '2' nth = theDate + 'nd';else if (theDate % 10 == 3) // exceptions ending in '3' nth = theDate + 'rd';else nth = theDate + 'th';document.write(dayName[now.getDay()] + " the " + thedate() +", " + "of " + monName[now.getMonth()] + ", " + now.getFullYear());
×
×
  • Create New...