Notepad is a most important and generic text editor which included with all versions of Microsoft Windows. Notepad allows you to open and read plaintext files. By using Notepad you can make any interesting and important things on your windows which means your desktop or laptop which contains any Microsoft windows programs. Today I teach you How to make a clock using Notepad which provides you with Date and Time. Now follow some steps and do it.
Make Clock and Date By Notepad
Step 3: Now open this Text Document by Double Clicking and paste bellow code.
@echo off
:start
echo Date:%date%Time:%time%
goto start
|
Step 4: This step click Save As and rename the file with clock.bat like bellow screenshot. Then click save button but remember one thing must you save there where you creating your Tex Document.
Step 5: Now click on clock icon and you can see Time and date is showing.
Now you are done and successfully created a Clock and date By notepad. Any problem please comment below. I will try to solve it. If you like this doesn’t forget to share it on social media. Remember the word is if you share this with others you have done for good work to learn others.
How To Make Clock and Date By Notepad (Part 2)
To create a clock and date using Notepad, you can use the following steps:
- Open Notepad on your computer.
- Type the following code into the text editor:
<html> <head> <title>Current Time</title> <script type="text/javascript"> function startTime() { var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('txt').innerHTML = h + ":" + m + ":" + s; var t = setTimeout(startTime, 500); } function checkTime(i) { if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10 return i; } </script> </head> <body onload="startTime()"> <div id="txt"></div> </body> </html>
- Save the file with a .html extension, such as “clock.html”.
- Double-click the saved file to open it in your web browser.
- You should see a clock displaying the current time in hours, minutes, and seconds.
To add the date, you can modify the code by adding the following lines to the start time() function:
var months = ["January","February","March","April","May","June","July", "August","September","October","November","December"]; var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"]; var d = new Date(); var month = months[d.getMonth()]; var day = days[d.getDay()]; var date = d.getDate(); var year = d.getFullYear(); document.getElementById("date").innerHTML = day + ", " + month + " " + date + ", " + year;
And then add the following HTML code to display the date on the page:
<p id="date"></p>
Your final code will look like this:
<html> <head> <title>Current Time</title> <script type="text/javascript"> function startTime() { var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('txt').innerHTML = h + ":" + m + ":" + s; var t = setTimeout(startTime, 500); var months = ["January","February","March","April","May","June","July", "August","September","October","November","December"]; var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"]; var d = new Date(); var month = months[d.getMonth()]; var day = days[d.getDay()]; var date = d.getDate(); var year = d.getFullYear(); document.getElementById("date").innerHTML = day + ", " + month + " " + date + ", " + year; } function checkTime(i) { if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10 return i; } </script> </head> <body onload="startTime()"> <div id="txt"></div> <p id="date"></p> </body> </html>
Save the file and open it in your web browser to see the clock and date displayed on the page.