Anyone could help with my issue? It’s not working for me, following the code:
<script>
.auto-date {
window.days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
window.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
function nthFormatter(d) {
if (d > 3 && d < 21) return 'th';
switch (d % 10) {
case 1: return "st";
case 2: return "nd";
case 3: return "rd";
default: return "th";
}
}
function currentTime() {
var date = new Date();
var hour = date.getHours();
var min = date.getMinutes();
if (min < 10)
min = "0" + min;
var ampm = hour >= 12 ? 'pm' : 'am';
var dayOfWeek = window.days[date.getDay()];
var month = window.months[date.getMonth()];
var day = date.getDate();
day += nthFormatter(day);
const autodate = {
weekday: “short”,
month:”short”
}
var t = setTimeout(function () { currentTime() }, 15000);
currentTime();
}
</script>