Start New Discussion within our Software Development Community

@Niloofar24 was looking for an Iranian datetime package and last night I found one in the internet so I wrote a simple code which counts the days and hours and seconds to Iranian new year

'''
this program is using the khayyam package .I think @Niloofar24 was looking for this
to install just type
sudo pip install khayyam
and if you have two different versions of python on your system :
sudo apt-get install python3-pip
sudo pip3 install khayyam

'''
import khayyam as kh
today_now = kh.JalaliDatetime.now()
print("today's date and time is :",today_now.strftime("%y-%m-%d, %H-%M-%S"))
print()
new_year = kh.JalaliDatetime(1394,1,1,2,15,11)  #which is a saturday
time_left = new_year-today_now

day_hour_minute = str(time_left).split(':')


print( day_hour_minute[0] ,'hours and ',day_hour_minute[1], 'minutes and ', day_hour_minute[2],'seconds left to Iranian new year')

I forgot to mention that if you go to www.taghvim.com/norooz.html you will see a nice count down timer to new year