 |
 |
Count Up App
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2005
Location: Atlanta
Status:
Offline
|
|
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
|
|
What is an "event"? You mean in iCal?
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Feb 2003
Location: NY²
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Thanks guys, this is helpful. I will try the JavaScript of the AppleScript.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|