Uzyskaj rok od daty wprowadzonej przez użytkownika w JavaScript
<html>
<head>
<title>Get year from user entered date</title>
</head>
<body>
Enter Your Birth day: <input type="date" name="birthday" id="date">
<button id="btn" onclick="getyear();">Get year</button>
<script>
function getyear()
{
var input=document.getElementById("date").value;
var d = new Date(input);
year = d.getFullYear();
window.alert("Entered year is "+year);
}
</script>
</body>
</html>
Cooperative Caterpillar