So i have this cell in my table in my div:
<body>
<div>
<table id="TableName" width="auto">
<thead>
<tr>
...
<th colspan="7" style="background-color: black; color: white; text-align: left;">
<div id="last_thursday" />
</th>
</tr>
and this code to write the value of the date for the last thursday in it.
$(document).ready(Main);
function Main() {
ConfigDate();
}
function ConfigDate() {
var currentTime = new Date();
var dayofWeek = currentTime.getDay();
var daysSinceThursday = (dayofWeek + 3) % 7
var lastThursday = new Date(currentTime.GetDate() - daysSinceThursday);
var dd = lastThursday.getDate();
var mm = lastThursday.getMonth() + 1;
var yyyy = lastThursday.getFullYear();
$("#last_thursday").text(yyyy + " / " + mm + " / " + dd);
}
Can someone tell me what I am doing wrong here cause my code isn’t writting at all in my cell?
I get the javascript error:
when I run it. I belive the method is
getDate()with a smallgfor get.Javascript console is your friend. 🙂