Knowledge Walls
Praveen Kumar R
Finding even and odd days and dates in Basics of JS learning
finding odd or even days and dates
		<!DOCTYPE html>
		<title> learning date and finding whether the day is odd or even</title>
		<h1> Find whether the day is odd or even </h1>
		<p id="demo"> </p>
		<label> Enter day </label>
		<input type="date" id="myDay"><br><br>
		<button type="button" onclick="printDay()">Find oddEven day</button> <br><br>
		<label> Enter date </label>
		<input type="date" id="myDate"><br><br>
		<button type="button" onclick="printDate()">Find oddEven date</button>
		function printDay(){
		var myDay = document.getElementById('myDay').value;
		var p = new Date(myDay);
		var newDay = p.getDay();
		if (newDay %2 == 0){
		console.log("it is a even day");
		console.log("it is an odd day");
		function printDate(){
		var myDate = document.getElementById('myDate').value;
		var dt = new Date(myDate);
		var newDate = dt.getDate();
		if (newDate%2 == 0){
		console.log("it is a even date");
		console.log("it is an odd date");
Next Topics
Next lessons of current book.
Previous Topics
Previous lessons of current book.
Best Lessons of "JS learning"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details