Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Count Up App

Count Up App
Thread Tools
Dedicated MacNNer
Join Date: Mar 2005
Location: Atlanta
Status: Offline
Reply With Quote
Oct 16, 2007, 10:22 AM
 
Is there any application to count the number of days since an event has occured?

Maybe something simple that can go on the menu bar or even better a UNIX command that will calculate it.

I just want to be able to see how long a event has occured since the current day.

Thanks.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Oct 16, 2007, 10:23 AM
 
What is an "event"? You mean in iCal?
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
mdc
Addicted to MacNN
Join Date: Feb 2003
Location: NY²
Status: Offline
Reply With Quote
Oct 16, 2007, 10:46 AM
 
Code:
<html> <head> <title>Days since x</title> </head> <body> <script> var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countup(yr,m,d){ var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todaystring=montharray[todaym]+" "+todayd+", "+todayy var paststring=montharray[m-1]+" "+d+", "+yr var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1) difference+=" days" document.write("It\'s been "+difference+" since your event") } //enter the count up date using the format year/month/day countup(2007,01,01) </script> </body> </html>
There's a simple html page that will count the amount of days since a date.

edit. A thought. The html page could be turned into a Dashboard Widget.
     
Dedicated MacNNer
Join Date: Mar 2005
Location: Atlanta
Status: Offline
Reply With Quote
Oct 16, 2007, 11:22 AM
 
It could go on iCal I suppose. I just want something easy and simple, that would be constantly available.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 16, 2007, 11:48 AM
 
I can't think of a Unix command that will do that, but you could easily write up a CLI script to do this if you don't want a webpage. Do you care what language it is in? This would be easy in PHP.
     
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Oct 16, 2007, 12:10 PM
 
Applescript:

Code:
set the_date to (date "Apr 15, 2007") set the_days to ((current date) - the_date) div days display dialog (the_days as text) & " days have passed since " & the_date
     
Dedicated MacNNer
Join Date: Mar 2005
Location: Atlanta
Status: Offline
Reply With Quote
Oct 16, 2007, 09:29 PM
 
Thanks guys, this is helpful. I will try the JavaScript of the AppleScript.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:53 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2