Time Left for New Year

All Sample Codes Date

We have to run this script to get the time left for new year. To display a countdown timer showing Hours Minutes and seconds left can be shown by using Tkitner.

After the time, on the new year, we can also show the Happy New Year message.
from dateutil.relativedelta import relativedelta
from datetime import datetime
dt=datetime.today()
print("Today:",dt) # current date and time 
print(" No of days left for New year")
dt2=datetime(dt.year+1,1,1,0,0,0) # Date and time for new year
dt3=relativedelta(dt2,dt) # time left for new year 
print("Years:", dt3.years, ", Months:",dt3.months, "Dayes:",dt3.days,
    ",Hours :",dt3.hours,", Minutes :",dt3.minutes, ", Seconds :",dt3.seconds)
Output
Today: 2021-12-27 17:04:00.848590
 No of days left for New year
Years: 0 , Months: 0 Dayes: 4 ,Hours : 6 , Minutes : 55 , Seconds : 59
Displaying Countdown time for new year using Tkinter window

Tkinter window showing countdown in Hour Minute and second left for new year with New year message


All Date Objects Date & Time Exercises
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer