I want to make a simple live date counter that would output in the html where ever the script is located in the file. Here's the JSFiddle, and here's that script:
var today = newDate();
var dd = today.getDate();
var mm = today.getMonth();
var yyyy = today.getFullYear();
if (dd = 1 || 21 || 31) {
dd = dd + 'st'
} else if (dd = 2 || 22) {
dd = dd + 'nd'
} else if (dd = 3 || 23) {
dd = dd + 'nd'
} else {
dd = dd + 'th'
}
if (mm = 0) {
mm = "JANUARY";
} else if (mm = 1) {
mm = "FEBRUARY";
} else if (mm = 2) {
mm = "MARCH";
} else if (mm = 3) {
mm = "APRIL";
} else if (mm = 4) {
mm = "MAY";
} else if (mm = 5) {
mm = "JUNE";
} else if (mm = 6) {
mm = "JULY";
} else if (mm = 7) {
mm = "AUGUST";
} else if (mm = 8) {
mm = "SEPTEMBER";
} else if (mm = 9) {
mm = "OCTOBER";
} else if (mm = 10) {
mm = "NOVEMBER";
} else {
mm = "DECEMBER";
}
today = dd + '|' + mm + '|' + yyyy;
document.write(today);
I know that this is the most inefficint and probably incorrect way of writing any code in general (this is the second thing i've ever done in JS.) but please have some acceptance for my stupid mistakes.
Thanks very much.