# 23+ Python Clock Examples

This post contains a total of 23+ Hand-Picked Python Clock Examples. All the clocks are made purely using Python Programming Language with a few examples that uses a little bit of css for styling.

You can use the source codes of these Python Clocks for education use ( With Credits to the Original Owner ) If you need it for something else then you should contact the owner for it.

### Related Posts

Click a Code to Copy it, and Hover over a video to play it.

## 1. By Sebastian Keßler Analogue

Python clock by Sebastian Keßler. The clock displays the time in numerical format and also show the time using clock hand. ( Source )

``````import math
import time

size = 15
minute = time.localtime()
hour = time.localtime()
print ('{}:{}'.format(hour, minute))
matrix = [[chr(179) for x in range(size)] for y in range(size)]

def f_minute (matrix, minute):
anstieg = math.tan((minute+15)*6*math.pi/180)
if minute >= 0 and minute < 15:
xmin = -len(matrix)//2
ymin = -len(matrix)//2
xmax = len(matrix)//2
ymax = 0
elif minute >= 15 and minute < 30:
xmin = 0
ymin = 0
xmax = len(matrix)//2
ymax = len(matrix)//2
elif minute >= 30 and minute < 45:
xmin = -len(matrix)//2
ymin = 0
xmax = 1
ymax = len(matrix)//2
elif minute >= 45:
xmin = -len(matrix)//2
ymin = -len(matrix)//2
xmax = 0
ymax = 1

for y in range (ymin, ymax):
for x in range (xmin, xmax):
if y == round(x * anstieg, 0) or x == y // anstieg:
matrix [x][y] = (chr(219))
return (matrix)

def f_hour (matrix, hour):
anstieg = math.tan((hour-15)*30*math.pi/180)
if hour >= 0 and hour < 3 or hour >= 12 and hour < 15:
xmin = 0
ymin = -len(matrix)//3
xmax = len(matrix)//3
ymax = 0
elif hour >= 3 and hour < 6 or hour >= 15 and hour < 18:
xmin = 0
ymin = 0
xmax = len(matrix)//3
ymax = len(matrix)//3
elif hour >= 6 and hour < 9 or hour >= 18 and hour < 21:
xmin = -len(matrix)//3
ymin = 0
xmax = 1
ymax = len(matrix)//3
elif hour >= 9 and hour < 12 or hour >= 21 and hour < 25:
xmin = -len(matrix)//3
ymin = -len(matrix)//3
xmax = 0
ymax = 1
for y in range (ymin, ymax):
for x in range (xmin, xmax):
if y == round(x * anstieg, 0) or x == y // anstieg:
matrix [x][y] = (chr(177))
return (matrix)

def anzeige (matrix):
for y in range (-len(matrix)//2, len(matrix)//2):
for x in range (-len(matrix)//2, len(matrix)//2):
print(matrix[x][y], end = '')
print()

matrix = f_minute (matrix, minute)
matrix = f_hour (matrix, hour)
anzeige (matrix)``````

## 2. By Mirielle

A digital by Mirielle that displays the current date and time along with the calendar of the current month. ( Source )

``````# Author : Cbr
# not sure if it's working right for you
zero,one,two,three,four,five,six,seven,eight,nine,m,a,p,sep,form = [[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,0]],[[0,0,1,0,0],[0,1,1,0,0],[1,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[1,1,1,1,1]],[[0,1,1,1,0],[1,0,0,0,1],[0,0,0,1,0],[0,0,1,0,0],[0,1,0,0,0],[1,1,1,1,1]],[[1,1,1,1,0],[0,0,0,0,1],[1,1,1,1,1],[0,0,0,0,1],[0,0,0,0,1],[1,1,1,1,0]],[[1,0,0,0,0],[1,0,0,0,0],[1,0,1,0,0],[1,1,1,1,1],[0,0,1,0,0],[0,0,1,0,0]],[[1,1,1,1,1],[1,0,0,0,0],[1,0,0,0,0],[1,1,1,1,1],[0,0,0,0,1],[1,1,1,1,1]],[[0,1,1,1,0],[1,0,0,0,0],[1,0,0,0,0],[1,1,1,1,0],[1,0,0,0,1],[0,1,1,1,0]],[[1,1,1,1,0],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1]],[[0,1,1,1,0],[1,0,0,0,1],[1,1,1,1,1],[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,0]],[[0,1,1,1,0],[1,0,0,0,1],[0,1,1,1,1],[0,0,0,0,1],[0,0,0,0,1],[0,1,1,1,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[1,1,0,1,1],[1,0,1,0,1],[1,0,0,0,1],[1,0,0,0,1]],[[0,0,0,0,0],[0,0,0,0,0],[0,1,1,0,0],[1,0,0,1,0],[1,1,1,1,0],[1,0,0,1,0]],[[0,0,0,0,0],[1,1,1,1,0],[1,0,0,1,0],[1,1,1,1,0],[1,0,0,0,0],[1,0,0,0,0]],[[0,0,0,0,0],[0,0,2,0,0],[0,0,2,0,0],[0,0,0,0,0],[0,0,2,0,0],[0,0,2,0,0]],'%Y-%m-%d %H:%M %p'
digdict_ = {str(i):v for i,v in enumerate([zero,one,two,three,four,five,six,seven,eight,nine])}
alpdict_ = {'a':a,'m':m,'p':p,':':sep}
all_dict = {**digdict_,**alpdict_}
now = __import__('datetime').datetime.now()
from time import strftime
print('It may not work for you \n')
print(f"Today is {now.year}-{now.month}-{now.day} \n")
lh = ((int(strftime('%H'))-3+24))%24
h,m= '00'+str(lh), '00'+strftime('%M')
ftime = f"{int(h[-2])}{int(h[-1])}:{int(m[-2])}{int(m[-1])}"
hours,mins = str(int(now.hour)-4), str(now.minute)
meridiem = now.strptime(f'{hours}','%H').strftime('%I %p').split(' ')
full_time = f'{ftime}{meridiem.lower()}'
for i in range(6):
for time in full_time:
for col in all_dict[time][i]:
if col == 0:
print(' ', end = "")
elif col == 1:
print('#', end = "")
elif col == 2:
print('*', end='')
print(" ",end="")
print()
#print(det('st')) if int(now.month) == 1 or str(int(now.month))[-1] == '1' else print(det('nd')) if int(now.month) == 2 or str(now.month)[-1] == '2' else print(det('rd')) if int(now.month) == 3 or str(now.month)[-1] == '3' else print(det('th'))
print()
[print(__import__('calendar',fromlist=[None]).month(now.year,now.month,4))]

# Written by Cbr``````

## 3. By MD. Ferdous Ibne Abu Bakar

Made by MD. Ferdous Ibne Abu Bakar. The clock is styled using css and is made using js but is displayed through python. It displays the current date, day and the time. ( Source )

``````
#Made by MD. Ferdous Ibne Abu Bakar

import os
print('''<body><div id="all"><div id="date"></div><div id="clock"></div><div id="today"></div> </div>
<script type="text/javascript" charset="utf-8">
function printTime() {
var d = new Date();
var hr = d.getHours();
var min = d.getMinutes();
var sec = d.getSeconds();
var day = d.getDay();
var date = d.getDate();
var mon = d.getMonth()+1;
var yar = d.getFullYear();

if (sec<10){
sec="0"+sec;
}
if (min<10){
min="0"+min;
}

if (hr>11){
sec=sec+'<span style="font-size: 6vw;"> PM</span>'
}
else {
sec=sec+'<span style="font-size: 6vw;"> AM</span>'
}

switch(hr){
case 0:
hr = 12;
break;

case 13:
hr = 1;
break;

case 14:
hr = 2;
break;

case 15:
hr = 3;
break;

case 16:
hr = 4;
break;

case 17:
hr = 5;
break;

case 18:
hr = 6;
break;

case 19:
hr = 7;
break;

case 20:
hr = 8;
break;

case 21:
hr = 9;
break;

case 22:
hr = 10;
break;

case 23:
hr = 11;
break;
}

document.getElementById("clock").innerHTML = hr+":"+min+":"+sec;
switch (day){

case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
break;
}

if(day<10){
day = "0" + day;
}
if(mon<10){

mon = "0" + mon;
}

document.getElementById("date").innerHTML = date+"–"+mon+"–"+yar;

document.getElementById("today").innerHTML = day;
}
setInterval(printTime);
</script>

<style type="text/css" media="all">

body {
height: 100vh;
margin: 0vh;
}

#date{
text-align: center;
font-size: 4vw;
color: #787878;
}
.dt{
text-align: center;
font-size: 4vw;
color: red;
}
#clock{
text-align: center;
font-size: 15vw;
}
#today {
text-align: center;
font-size: 6vw;
color: #787878;
}

img{
display: none;
}

</style>
</body>''')
os.system('touch file.png')``````

## 4. By Potato Hacker

Basic Python clock by Potato Hacker. The clock displays the current date and the current time. ( Source )

``````import datetime

now = datetime.datetime.now()
year = now.year
month = now.month
day = now.day
print ("Date:",year, "/", month, "/",day)
hour = now.hour
minute = now.minute
second = now.second
print ("Clock:", hour,":",minute,":",second)``````

## 5. By Shivansh Kumar Singh

Made by Shivansh Kumar Singh. It also displays the current date and time. ( Source )

``````from datetime import datetime
now = datetime.now()
mm = str(now.month)
dd = str(now.day)
yyyy = str(now.year)
hour = str(now.hour)
mi = str(now.minute)
ss = str(now.second)
print(mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss)``````

## 6. By David Carroll

Made by David Carroll. Its a revised version of the python clock made by Cbr✔[ ZeroCharisma ]. You can change the time zone if you want to get the current time of a different location. ( Source )

``````# Created by Cbr✔[ ZeroCharisma ]
# Revised by David Carroll
from datetime import datetime, timedelta
import calendar
import re

timezone = "Etc/GMT+5"  # CDT
#timezone = "Etc/GMT+4" # EDT
#timezone = "IST"       # India
#timezone = "Etc/GMT+0" # UTC

# NOTHING MORE TO EDIT BELOW THIS LINE
# --------------------------------------
def main():
# Digits 0 - 9
patterns_dict = {str(digit): pattern for digit, pattern in enumerate(
[
convert([14, 17, 17, 17, 17, 14]),
convert([4, 12, 20, 4, 4, 31]),
convert([14, 17, 2, 4, 8, 31]),
convert([30, 1, 31, 1, 1, 30]),
convert([16, 16, 20, 31, 4, 4]),
convert([31, 16, 16, 31, 1, 31]),
convert([14, 16, 16, 30, 17, 14]),
convert([30, 1, 1, 1, 1, 1]),
convert([14, 17, 31, 17, 17, 14]),
convert([14, 17, 15, 1, 1, 14])
]
)}

patterns_dict.update([
('a', convert([0, 0, 12, 18, 30, 18])),
('m', convert([0, 0, 0, 27, 21, 17, 17])),
('p', convert([0, 30, 18, 30, 16, 16])),
(':', convert([0, 4, 4, 0, 4, 4], 2))]
)

now = get_current_datetime()

print(f'Today is {now.strftime("%Y-%m-%d")} \n')

display_time = f'{now.strftime("%I:%M%p").lower()}'

display_char = [' ', '#', '*']

for row in range(6):
for time_char in display_time:
for col in patterns_dict[time_char][row]:
print(display_char[col], end="")
print(" ", end="")
print()
print()

[print(calendar.month(now.year, now.month, 2))]
def get_utcOffset():
utcOffset = int(re.search(r"([+-])(\d+)\$", timezone).group())

if re.search(r"([+-])(\d+)\$", timezone).group() == "-":
utcOffset = utcOffset * -1

return utcOffset

def get_utcoffset_timedelta():
return timedelta(hours=-6, minutes=30) \
if timezone == "IST" \
else timedelta(hours=get_utcOffset())

def get_current_datetime():
now = datetime.now()
return now - get_utcoffset_timedelta()

def change_onbit(value):
return 2 if value == 1 else value

def convert(rows, onbit=1):
result = [[int(num) for num in
'{0:05d}'.format(
int(bin(row)[2:])
)] for row in rows]

if onbit != 1:
result = [list(map(change_onbit, row))
for row in result]
return result

if __name__ == "__main__":
main()

# Version with pytz timezone module and all my comments:
# https://code.sololearn.com/chDyq5kLBVxn/``````

## 7. By Kuba Siekierzyński

Digital clock by Kuba Siekierzyński. The clock shows the time multiple times with different styling. ( Source )

``````Digital clock
Coded by Kuba Siekierzynski (c) 2018

UPDATE 2: random styles
"""

import sys, codecs
sys.stdout = codecs.getwriter('utf_16')(sys.stdout.buffer, 'strict')

from datetime import datetime as dt
from random import sample as s

# the number of style samples should be < 6
# to avoid "Time limit exceeded"
samples = 5

px = (
(chr(11035), chr(11036)), # classic
(chr(11036), chr(11035)), # classic negative
(chr(11035), chr(8419)),  # classic blue
(chr(8419), chr(11035)),  # classic blue neg
(chr(11036), chr(8419)),  # modern
(chr(8419), chr(11036)),  # modern negative
(chr(9898), chr(128308)), # red-on-white
(chr(128308), chr(9898)), # white-on-red
(chr(9898), chr(9899)),   # black-on-white
(chr(9899), chr(9898)),   # white-on-black
(chr(128308), chr(9899)), # black-on-red
(chr(9899), chr(128308)), # red-on-black
)

digits = [

[ # zero
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]],

[ # one
[0,0,1,0,0],
[0,1,1,0,0],
[1,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[1,1,1,1,1]],

[ # two
[0,1,1,1,0],
[1,0,0,0,1],
[0,0,0,0,1],
[0,0,0,1,0],
[0,0,1,0,0],
[0,1,0,0,0],
[1,1,1,1,1]],

[ # three
[0,1,1,1,0],
[1,0,0,0,1],
[0,0,0,0,1],
[0,0,1,1,0],
[0,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]],

[ # four
[0,0,0,1,0],
[0,0,1,1,0],
[0,1,0,1,0],
[1,0,0,1,0],
[1,1,1,1,1],
[0,0,0,1,0],
[0,0,0,1,0]],

[ # five
[1,1,1,1,1],
[1,0,0,0,0],
[1,0,0,0,0],
[1,1,1,1,0],
[0,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]],

[ # six
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,0],
[1,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]],

[ # seven
[1,1,1,1,1],
[1,0,0,0,1],
[0,0,0,1,0],
[0,0,1,0,0],
[0,1,0,0,0],
[0,1,0,0,0],
[0,1,0,0,0]],

[ # eight
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]],

[ # nine
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,1],
[0,0,0,0,1],
[1,0,0,0,1],
[0,1,1,1,0]]]

# clock preparation
clock = list([0 for i in range(32)] for j in range(9))

# colon is fixed
clock = 1
clock = 1
clock = 1
clock = 1
clock = 1
clock = 1
clock = 1
clock = 1

now = dt.now() # GMT time
hr, mn = now.hour, now.minute

# the real hour in HH:MM format
h = ('0' + str(hr))[-2:] + ('0' + str(mn))[-2:]

# put the digits on the clock display
for i in range(len(h)):
d = int(h[i])
for j in range(len(digits[d])):
for k in range(len(digits[d])):
clock[j+1][1+(i//2*4)+k+i*7] = digits[d][j][k]

print(f'Timezone: Zulu\nTurn to landscape mode if illegible.\n')

# remember to tilt the device to landscape
for style in s(range(len(px)), samples):
for line in clock:
for pixel in line:
print(px[style][pixel], end='')
print()
print()``````

## 8. By Caleb Guerra Ortega

Python clock by Caleb Guerra Ortega. ( Source )

``````from datetime import datetime
"""
Run in Pydroid3, not in SoloLearn, I don't know if in other app for program in Python have this efect.
"""

## #9 – By Rushat Yadav

Made by Rushat Yadav the clock displays the date and the time. ( Source )

``````import datetime
now = datetime.datetime.now()
year = now.year
month = now.month
day = now.day
print ("Date:",day, "/", month, "/",year)
hour = now.hour
minute = now.minute
second = now.second
print ("Clock:", hour,":",minute,":",second)
#it may not work for you due to different timezones
#upvote if you like it``````

## 10. By Tamaslud

Made by Tamaslud. The clock is styled like a digital clock, and you can change the timezone offset of the clock also to get the time of a different place. ( Source )

``````'''
the code displays the current time
like a digital clock.
set the timezone offset below to see your local time.

coded by tamaslud after 100 day of sololearning
'''

timezone_offset = 1
from time import strftime
localhour = ((int(strftime('%H')) + timezone_offset + 24))%24
h = '00' + str(localhour)
m = '00' + strftime('%M')
a, b = int(h[-2]), int(h[-1])
c, d = int(m[-2]), int(m[-1])
x = 4
s =(
(('#'), ('#'), ('#'), (' '), ('#'), ('#'), ('#')),
((' '), (' '), ('#'), (' '), (' '), ('#'), (' ')),
(('#'), (' '), ('#'), ('#'), ('#'), (' '), ('#')),
(('#'), (' '), ('#'), ('#'), (' '), ('#'), ('#')),
((' '), ('#'), ('#'), ('#'), (' '), ('#'), (' ')),
(('#'), ('#'), (' '), ('#'), (' '), ('#'), ('#')),
(('#'), ('#'), (' '), ('#'), ('#'), ('#'), ('#')),
(('#'), (' '), ('#'), (' '), (' '), ('#'), (' ')),
(('#'), ('#'), ('#'), ('#'), ('#'), ('#'), ('#')),
(('#'), ('#'), ('#'), ('#'), (' '), ('#'), ('#'))
)

print ('\n {}   {}         {}   {}'.format(x*s[a], x*s[b], x*s[c], x*s[d]))
print ('{}{}{} {}{}{}       {}{}{} {}{}{}'.format(s[a], x*' ', s[a], s[b], x*' ', s[b], s[c], x*' ', s[c], s[d], x*' ', s[d]))
print ('{}{}{} {}{}{}   #   {}{}{} {}{}{}'.format(s[a], x*' ', s[a], s[b], x*' ', s[b], s[c], x*' ', s[c], s[d], x*' ', s[d]))
print (' {}   {}         {}   {}'.format(x*s[a], x*s[b], x*s[c], x*s[d]))
print ('{}{}{} {}{}{}   #   {}{}{} {}{}{}'.format(s[a], x*' ', s[a], s[b], x*' ', s[b], s[c], x*' ', s[c], s[d], x*' ', s[d]))
print ('{}{}{} {}{}{}       {}{}{} {}{}{}'.format(s[a], x*' ', s[a], s[b], x*' ', s[b], s[c], x*' ', s[c], s[d], x*' ', s[d]))
print (' {}   {}         {}   {}\n'.format(x*s[a], x*s[b], x*s[c], x*s[d]))
print('\n(you can change the timezone offset in the code)')``````

## 11. By IDIOT KID

Made by IDIOT KID. Its a three line python clock that shows the time and prints a message at the end. ( Source )

``````import time
print(time.strftime("TIME ACCORDING TO UTC IS - %I %M %S %p on %A, %B %e, %Y"))

## 12. By Hisham YUM 🇲🇦

Made by Hisham YUM 🇲🇦. ( Source )

``````#Run it on you laptop this app can't run it properly
#Created by Hisham SH
import time
while True:
local= time.localtime()
result= time.strftime("%I:%M:%S %p", local )
print(result, end="", flush= True)
print("\r", end="", flush= True)
time.sleep(100)``````

## 13. By Julian

Made by Julian. The clock is designed to look like a digital clock. ( Source )

``````from time import strftime, gmtime
time = strftime("%H:%M:%S", gmtime())

elements = [" _ | ||_|", "     |  |", " _  _||_ ", " _  _| _|", "   |_|  |", " _ |_  _|", " _ |_ |_|", "__  |  |", " _ |_||_|", " _ |_| _|", "    *  * "]

i = 0
n = 3
for j in range(3):
for k in str(time):
for c in range(0, 10):
if k == ":":
print(elements[i:n], end="")
break
elif int(k) == c:
print(elements[c][i:n], end="")
break
print()
i += 3
n += 3``````

## 14. By Chetchasov Ivan

Python clock by Chetchasov Ivan. Its made using js and styled using css, the clock is displayed using python. ( Source )

``````import os
print("""<!DOCTYPE html><html><head><title></title><style>*{margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;}body{background-color:darkgray;}h1{text-align:center;font-family:"Courier New", Courier, monospace;background-color:black;color:Lime;border: 5px solid black;border-right-color:white;border-bottom-color:white;border-top-color:lightgray;border-left-color:gray;}button{background-color:brown;color:magenta;border-radius:34px;border:2px dotted black;}h2{text-align:center;font-family:"Courier New", Courier, monospace;background-color:black;color:Lime;border: 5px solid black;border-right-color:white;border-bottom-color:white;border-top-color:lightgray;border-left-color:gray;}</style></head><body><script>function c(){var d = new Date();var h = d.getHours();var m = d.getMinutes();var s = d.getSeconds();document.getElementById("h1").innerHTML=h+":"+m+":"+s;}setInterval(c, 1000)</script><br /><h2>Time</h2><h1 id="h1"></h1></body></html>""")
os.system("touch file.png")``````

## 15. By FF9900

Python binary clock by FF9900. ( Source )

``````# binary clock in python
# It shows _local_ time, i.e UTC on the server.
# Version 1.0
#
import time

binarr=[]
B=['.','o']
for a in B:
for b in B:
for c in B:
for d in B:
binarr.append("{0}{1}{2}{3}".format(a,b,c,d))

t = time.localtime()

print("\n# binary clock - list comprehension\n")
for l in [binarr[int(x)] for x in "{0:02d}{1:02d}{2:02d}".format(t.tm_hour,t.tm_min,t.tm_sec)]:
print(l)

print("\n# binary clock - map\n")
for l in map(lambda x: binarr[int(x)],"{0:02d}{1:02d}{2:02d}".format(t.tm_hour,t.tm_min,t.tm_sec)):
print(l)

print("\n# binary clock - straightforward\n")
for l in ["{0:04b}".format(int(x)) for x in "{0:02d}{1:02d}{2:02d}".format(t.tm_hour,t.tm_min,t.tm_sec)]:
print(l.replace("0",".").replace("1","o"))

print("\n# binary clock - straightforward/minimal")
print(*["\n{0:04b}".format(int(x)).replace("0",".").replace("1","o") for x in "{0:02d}{1:02d}{2:02d}".format(t.tm_hour,t.tm_min,t.tm_sec)])
``````

## 16. By Zapp

Made by Zapp. It displays the current date and the current time. ( Source )

``````import time
while True:
from datetime import datetime
now = datetime.now()
print ("%s/%s/%s %s:%s:%s" % (now.month,now.day,now.year,now.hour,now.minute,now.second))
time.sleep(1)``````

## 17. By Love

Made by Love that displays the date and time. ( Source )

``````import time
while True:
print(time.strftime("%d %B, %Y; %I:%M:%S %p"),"\r",end="")``````

## 18. By Raphael VDB

Made by Raphael VDB. It prints out the current year, day, date and time. ( Source )

``````from datetime import datetime
now = datetime.now()

print ("year:")
print (now.year)

print ("month:")
print (now.month)

print ("day:")
print (now.day)

print ("hour:")
print (now.hour)

print ("minute:")
print (now.minute)``````

## 19. By Srijan

Basic python clock by Srijan that shows the date and the time. ( Source )

``````# Created by Srijan
"""
First python code and first code on sololearn. Pls give an upvote
"""
__author__ = "Srijan"

import time
print(time.asctime())``````

## 20. By Mfundo Shabalala

Made by Mfundo Shabalala. It shows the current date and the current time. ( Source )

``````#Attempt in creating digital clock

import time,sys
from datetime import datetime

while True:
now = datetime.now()
print(time.strftime("%d/%m/%Y %H:%M:%S"), end = '', flush = True)
print('\r',end = '', flush = True)
time.sleep(100)``````

## 21. By arinbjorn

Made by arinbjorn. ( Source )

```08:54:14.343637
08:54:15.344689
08:54:16.345768```
``````import datetime
import time

for i in range(3): # wind up clock
print(datetime.datetime.now().time())
time.sleep(1)``````

## 22. By Raphael Shay

Made by Raphael Shay. A simple Python clock program that displays the time in israel. ( Source )

```The time in Israel is 11:55:31

The date in Israel is 11/7/2022```
``````from datetime import datetime as dt

now = dt.now()

print("The time in Israel is %s:%s:%s\n" % (now.hour + 3, now.minute, now.second))

print("The date in Israel is %s/%s/%s" % (now.day, now.month, now.year))``````

## 23. By Ferhat Sevim

Made by Ferhat Sevim. Simple digital clock. ( Source )

```Today is: 2022 - 7 - 11
Time is: 10 : 56 : 58```
``````from time import *
now = localtime()
print("Today is:",now,"-",now,"-",now)
print("Time is:",now+2,":",now,":",now)

#Change number next now to which timezone you have``````

## 24. By Patriot Programmer

Made by Patriot Programmer. ( Source )

`08:57:46 AM`
``````import time
while True:
local= time.localtime()
result= time.strftime("%I:%M:%S %p", local )
print(result, end="", flush= True)
print("\r", end="", flush= True)
time.sleep(1)``````