Real Time Clock. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

Real Time Clock.

I don't Know how to i make a Real time clock , like a It's Show me If time is 12:00:00 am (Midnight) If time is 04:00:00 am (Early Morning) If time is 06:00:00 am (Morning) If time is 12:00:00 pm (Afternoon) If time is 04:00:00 pm (Close to Evening) If time is 06:00:00 pm (Evening) If time is 09:00:00 pm (Night) How to i make this clock ????

26th Jun 2021, 3:25 AM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
7 Answers
26th Jun 2021, 4:38 AM
furqan elahie
furqan elahie - avatar
+ 6
U can make it in an easy way using js function https://code.sololearn.com/W32EC03bI267/?ref=app
26th Jun 2021, 5:14 AM
Ahmed Afgooye 🇸🇴 🇸🇴
Ahmed Afgooye 🇸🇴 🇸🇴 - avatar
+ 5
An example with html and php clock: https://code.sololearn.com/w2yqPJJ8ew39/?ref=app
26th Jun 2021, 6:07 AM
JaScript
JaScript - avatar
+ 4
Ayesha Noor You can make Clock and then after getting hours, minutes, seconds and 'AM' or 'PM' you can compare with value to print given String like this: function compareWitTime(hours, minutes, seconds, dn) { if(minutes != '00' || seconds != '00') return ""; if(hours == 12 && dn == 'AM') return "Midnight"; else if(hours == 4 && dn == 'AM') return "Early Morning"; } Here is reference: https://code.sololearn.com/WA51A5a9A44a/?ref=app
26th Jun 2021, 4:35 AM
A͢J
A͢J - avatar
+ 2
https://code.sololearn.com/WOvVf7KAOK1x/?ref=app Use it becoz its simple and easy to use Supported by almost all browsers except internet explorer older versions..
26th Jun 2021, 9:50 AM
Andrew
Andrew - avatar
+ 1
https://code.sololearn.com/W9L409X3Y8KT/?ref=app
27th Jun 2021, 6:15 PM
Gaurav Dixit🇮🇳
Gaurav Dixit🇮🇳 - avatar