-
D.getDate() “st” “th” “rd” “nd”
Other than the obvious which is add something like
I = D.getDate();
if (I == “14”) = {I + “th”}and incorporate it in the below. Is there an easier way to add “th” “nd” “rd” “st”?
month = new Array();
month[0] = “January”;
month[1] = “February”;
month[2] = “March”;
month[3] = “April”;
month[4] = “May”;
month[5] = “June”;
month[6] = “July”;
month[7] = “August”;
month[8] = “September”;
month[9] = “October”;
month[10] = “November”;
month[11] = “December”;D = new Date(Date(0));
“” + D.getDate() + ” ” + month[(D.getMonth())] + ” ” + D.getFullYear()I’m probably being a bit thick, but thought I’d ask if anyone has any other quick solutions that to write and Array and if it ends in 1 put “st” etc.
Also whilst I’m playing around with this,
Is there an easy way to get something like this to work?
D = new Date(Date(0));
Day = (D.getDate());
Month = month[(D.getMonth())];If (Day + Month == “July 31”){“” + month[(D.getMonth()+1)] + “1st”)};
else
{“”+ Month + ” ” + Day} ;I have to export tomorrows date, but adding a plus one to the day is no problem, but if it’s the last day of the month I get July 32 hahaha, but I need August 1