View Single Post
BluesLee's Avatar
Posts: 411 | Thanked: 1,105 times | Joined on Jan 2010 @ Europe
#2
Originally Posted by ejasmudar View Post
I want to make a QBW that will show the no of days remaining to a particular day. Can somebody please show me how we can make a bash/python script that will output, say for example "56 days remaining"?
Something like that?

Code:
echo "$(( ($(date -d "110923" +%s) - $(date +%s)) / 86400 )) days remaining"
p.s. 1. 110923=particular day X=23rd September of 2011 in my case
2. "date +%s" gives you the seconds since unix epoch, i.e. since 1970-01-01 00:00:00 UTC
3. 86400 secs a day = 60 secs * 60 min * 24 hours

Last edited by BluesLee; 2011-09-04 at 09:52.
 

The Following User Says Thank You to BluesLee For This Useful Post: