-2
I need a method that converts the time and minutes typed in < input type="time" > by user in minutes.
ex: 01:35 return 95 minutes
it is possible to perform operations with this input ?
-2
I need a method that converts the time and minutes typed in < input type="time" > by user in minutes.
ex: 01:35 return 95 minutes
it is possible to perform operations with this input ?
2
Solution to the problem:
<!DOCTYPE html>
<html>
<body>
<input type="time" id="data">
<button onclick="minutes()">Result</button>
<p id="value"></p>
<script>
var data = document.getElementById("data");
var value = document.getElementById("value");
function minutes() {
let f0 = data.value.split(":");
value.innerHTML = ((Number(f0[0])*60)+Number(f0[1])) + " Minutes";
return 0;
}
</script>
</body>
</html>
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
What would be the date format? 5h 2min or 5:02 in input?
– Maury Developer
the time format typed in input type=time 5:02 and returned the value 302
– Caio Santos
Already answered. If it works let me know.
– Maury Developer
Thanks Master was exactly what I needed! : D
– Caio Santos