Special Clock-date : Python

# 2025-01-14
# author: cmLai
# name: clock-date
# description: clock with minutes and seconds pass this day
# and days pass this year
# txt mode


from __future__ import print_function



while True :
    from datetime import datetime
    import time
    # get current date and time
    now = datetime.now() 



    thismoment = now.strftime("%Y-%m-%d %H:%M:%S %A\n")


# yy: year
# mm: month
# dd: day
# thisday: days passed this year
# week: week on the day


    yy = int (now.strftime("%Y"))
    mm = int (now.strftime("%m"))
    dd = int (now.strftime("%d"))
    thisday = now.strftime("%j")
    week = now.strftime("%A")

# hr: hour
# mn: minute
# sd: second

    hr = int(now.strftime("%H"))
    mn = int(now.strftime("%M"))
    sd = int(now.strftime("%S"))



# print (thismoment)

#print ("This program runs at ", thismoment, "\n")

#print ("今年過了 ", thisday, " 天")


#print ("This year passes ", thisday, " days")


# ttmn: total minutes pass by
# ttsd: total seconds pass by

    ttmn = hr*60+mn
    ttsd = hr*3600+mn*60+sd

# print ("Year - day T minute:second / second")
    print (yy, "-", thisday, "T", ttmn, ":", sd, "/", ttsd, end="\r")
# print (week)   
    time.sleep(1)
    
    


# name: clock-date
# description: clock with minutes and seconds pass this day
# and days pass this year
# txt mode

# author: cmLai
# 2025-01-14




Comments

Popular posts from this blog

農曆新年 1901-2100 + 立春

公曆農曆對照

曆法(時間3)