I am new to using JavaScript and I recently attempted to add a date to my website using the following code:
external script_
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000) year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+ "")
The issue is that in my HTML file, it appears like this:
<p><strong>Current Date is : </strong><script src="js/datescript.js" id="sc"></script><br>
I want the text of the script to match the text of the <p>
, how can I achieve this?