JavaScript
I have two datetime input fields (today's date and exam date) and i would like to display the time difference between the two user inputs in my alert JavaScript box for only 5 seconds.
So far i can only display my three variables module code, today's date and exam date.
I cant seem to get the code right,
like changing value="2017-10-22T10:00:00" into miliseconds
the datetime format is making it hard for me to convert to miliseconds
What I have tried:
<form class="form">
<label><b>Module Code</b></label> <br>
<input id="f1" name="module" type="text" autofocus required placeholder="Module Code"><br>
<label><b>Today's Date</b></label> <br>
<input name="time_start" type="datetime-local" id="f2" placeholder="Select" value="2017-10-22T10:00:00"><br>
<label><b>Exam's Date</b></label> <br>
<input name="time_end" type="datetime-local" id="f3" placeholder="Select" value="2017-10-30T10:00:00"><br>
<button type="submit" class="signupbtn" onClick="processData('f1','f2','f3')">Calculate</button>
</form>
function processData(f1,f2,f3)
{
var module = document.getElementById(f1).value;
var time_start = document.getElementById(f2).value;
var time_end = document.getElementById(f3).value;
alert(module + "\n" + time_start + "\n" + time_end);
}