alperen dikici

Timer

A simple application that displays the current date and time in a formatted way.

date:
time:

Source Code (Python)

# coding=utf-8

"""
    Timer usage
    A small application that displays the date
"""

import time
import os
import platform


def clear():
    if platform.system() == 'Linux' or platform.system() == 'Darwin':
        os.system('clear')
    else:
        os.system('cls')


while True:

    time_data = time.localtime()
    year = time_data[0]
    month = time_data[1]
    day = time_data[2]
    hour = time_data[3]
    minute = time_data[4]
    second = time_data[5]

    time.sleep(1)
    clear()

    print("""
        date: {}/{}/{}
        time : {}:{}:{}
        """.format(day, month, year, hour, minute, second))