I have a multi part problem. I am creating a website and for part of the website I want to include todays date. I know there is a simple way to get todays date using date(). but I don't like that method because it prints out a very technical date.
I am using javascript to create a function that will get todays date for me. I just want it to print out something like "Tuesday May 23, 2017".
<head>
<title> My website </title>
</head>
<body>
<h1 id="getTIME"> Read something here </h1>
<script>
function getFormattedDate(today)
{
var week = new Array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday);
var day = week[today.getDay()];
var calender = new Array('january', 'febuary', 'march', 'april', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december');
var month = calender[today.getMonth()+1];
var dd = today.getDay();
var year = today.getFullYear();
return day + calender +','+ dd + year;
}
var date=getFormattedDate(date);
document.getElementById("getTIME").innerHTML = date;
</script>
</body>
I know there is something wrong with my javascript But i think its very close to finding the date how I want it to.
The next part of my question is that i am putting the date in h1. but everything else that I write in h1 wont appear. Is there a way to make the text "Read something here" and the date show up on h1 at the same time?