Display a Digital Clock

HTML + JS (ES6), 8 + 60 = 68 bytes

Tested in Chrome.

setInterval`a.innerHTML=new Date().toLocaleTimeString('fr')`
<a id=a>

-1 byte (@ETHProductions): Use French time format instead of .toTimeString().slice(0,8)


HTML + JS (ES6), 8 + 62 = 70 bytes

This will work in FireFox.

setInterval('a.innerHTML=new Date().toLocaleTimeString`fr`',0)
<a id=a>

-3 bytes (@ETHProductions): Use French time format instead of .toTimeString().slice(0,8)


Python 2, 50 bytes

(Python 2.1+ for ctime with no argument)

import time
while 1:print'\r'+time.ctime()[11:19],

time.ctime() yields a formatted string, from which the hh:mm:ss may be sliced using [11:19] (it remains in the same location whatever the date and time).

printing the carriage return '\r' before the text and making the text the first item of a tuple with , effectively suppresses the implicit trailing '\n' and overwrites the previously written output.

while 1 loops forever.


Mathematica, 48 41 37 28 bytes

Do[s=Now[[2]],∞]~Monitor~s

The output will be a TimeObject, refreshing continuously.

Looks like this: enter image description here

Alternative versions

48 bytes:

Dynamic@Refresh[TimeObject[],UpdateInterval->.1]

53 bytes:

Dynamic@Refresh[DateString@"Time",UpdateInterval->.1]

Tags:

Code Golf