Share your repls and programming experiences

← Back to all posts
REAL time clock
nbash (7)

Wellcome to Clock were you can see the real time! Thanks to @bigminiboss for helping me with this!

My code:

<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>repl.it</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <p id='time'></p> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"> </script> <script>
		document.getElementById("time").innerHTML = moment().format('MMMM Do YYYY, h:mm:ss a');
		function sleep(ms){return new Promise(resolve => setTimeout(resolve, ms))};
		async function Tutor(text, to_write='write', delay=50, to_erase='erase') {
		document.getElementById(to_write).className = "button";
		if (to_erase != "None"){
		document.getElementById(to_erase).remove();
		}
			for (let i = 0; i < text.length; i++) {        
					await sleep(delay);
					document.getElementById(to_write).innerHTML += text[i];
			}
		}
		function Linkwrite(){
			Tutor('https://replit.com/@nbash/rescuepets?v=1', to_write="link1", to_erase="None");
			Tutor('https://replit.com/@nbash/fun?v=1', to_write="link2", to_erase="None");
		}
		async function Time() {
			while (true){
				document.getElementById('time').innerHTML = moment().format('MMMM Do YYYY, h:mm:ss a');
				await sleep(100);
			}
		}
		Time()
		Linkwrite()
	</script>
	
	<button onclick="Tutor('Welcome to my new Replit called Clock! Clock is a place were you can see what time it is for real, but it is only the EST time. If you want to do something you can go look at these links: https://replit.com/@nbash/rescuepets?v=1 https://replit.com/@nbash/fun?v=1')" class="button" id="erase">Click To Start!</button>
	<a href="https://replit.com/@nbash" target="_blank" rel="noopener noreferrer" id="write" onclick="Linkwrite()"></a>
	<div><br></div>
	<a href="https://replit.com/@nbash/fun?v=1" target="_blank" rel="noopener noreferrer" id="link1" class="notabutton">https://replit.com/@nbash/fun?v=1</a>
	<a href="https://replit.com/@nbash/rescuepets?v=1" target="_blank" rel="noopener noreferrer" id="link2" class="notabutton">https://replit.com/@nbash/rescuepets?v=1</a>
</body> </html>
Comments
hotnewtop
ch1ck3n (2340)

if it didnt show the real time it wouldn't be a clock :|

nbash (7)

@ch1ck3n it shows the real time tho!

nbash (7)

Thanks for looking at "Clock" :)