Contoh kelas waktu datetime python

# Python program to demonstrate time class
# import the date class
from datetime import time

# calling the constructor
my_time = time(16, 1, 5)
print("Entered time", my_time)

# Calling constructor with 0 argument
my_time = time()
print("\nTime without argument", my_time)

# calling constructor with minute argument
my_time = time(minute=1)
print("\nTime with one argument", my_time)

# calling constructor with hour argument
my_time = time(hour=8)
print("\nTime with one argument", my_time)

# calling constructor with minute argument
my_time = time(second=5)
print("\nTime with one argument", my_time)
Outrageous Ostrich