I am new to ASP.Net core. I am doing a simple web application to find the difference between to date/time values. To get the difference I have a java script . But the thing is in the java script I am not able to access the date/time picker controls. I am not sure if what I have done is correct. Could someone please take a look and tell what's the real issue. Is this the correct way to get the difference. ie. I need to get the difference in hh:mm format with the data/time combined. Heres relevant the markup/code I am using.
<html>
<body style="background-color:Highlight">
<script>
function onSelectTime() {
var Start = document.getElementById("startdate").innerHTML+ " " + document.getElementById("starttimme").innerHTML;
var End = document.getElementById("enddate").innerText + " " + document.getElementById("endtime").innerText;
var Diff = End - Start;
document.getElementById("practicetime").innerHTML = Diff.toString();
}
</script>
<div class="text-center">
<label style="color:white">Start Date</label>
<input type="date" id="startdate" name="startdate" value="@DateTime.Now.ToString("yyyy-MM-dd")" />
<label style="color:white" id="lblstarttime">Start Time</label>
<input type="time" id="starttime" name="starttime" value="@DateTime.Now.ToString("hh:mm")" />
<br />
<br />
<label style="color:white">End Date</label>
<input type="date" id="enddate" name="enddate" value="@DateTime.Now.ToString("yyyy-MM-dd")" />
<label style="color:white">End Time</label>
<input type="time" id="endtime" name="endtime" value="@DateTime.Now.ToString("hh:mm")" />
<br />
<br />
<button onClick="onSelectTime()">Click</button>
</div>
</body>
</html>