[Solved] Script to show days left
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"?
Kindof like this config for rainmeter:http://jrweinman.deviantart.com/art/...Days-199156665 |
Re: [Request] Script to show days left
Quote:
Code:
echo "$(( ($(date -d "110923" +%s) - $(date +%s)) / 86400 )) days remaining" 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 |
Re: [Request] Script to show days left
can u explain what those constants (110923, 86400) are ?
|
Re: [Request] Script to show days left
like he says:
110923 = 23rd September 2011 86400 secs a day = 60 secs * 60 min * 24 hours |
Re: [Request] Script to show days left
Quote:
But is the date format dependent on the region/date-format settings? ie, my date is shown as 23/09/2011 so will it be 230911 or is it independant of those settings? |
Re: [Request] Script to show days left
It'd be cool to have a desktop widget for this.
|
Re: [Request] Script to show days left
1 Attachment(s)
Thanks to the brilliant QBW, i made a widget on my desktop with the above scripts.
Thanks blueslee and phap! TMO rocks! |
Re: [Solved] Script to show days left
Nice, this looks really good, perhaps an step by step walkthough on how to create one of these babies for us mortals would be fitting. :)
|
Re: [Solved] Script to show days left
Well done! I'd also love a step by step walkthrough :). Thanks!
|
Re: [Solved] Script to show days left
@peterch405, vkthor
Do you guys have Queen Beecon Widget installed? If not, pls install it. Now, in the desktop screen, click on add new widget, and add a queen beecon widget (aka QBW) Now, click on the widget edit button (the spanner icon thingy) of the QBW. A settings window will popup. Here are the MAIN thing to do in that window: 1. Click on "add Cmd" 2. Give the new command a name (something like Days Remaining) 3. Copy the above command by BluesLee and paste it in the Command Box. 4. Change "Type" from Beecon to Snippet 5. Towards the bottom of the window, there is a section "Update Policies & GPS/Location". Change the @Interval to 1 day. The rest of the settings are mainly cosmetic and can be changed as you wish to get the look you want. Dont be afraid to experiment. |
All times are GMT. The time now is 06:13. |
vBulletin® Version 3.8.8