• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Correcting AGE_INFO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correcting AGE_INFO


  • Subject: Re: Correcting AGE_INFO
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 04 Feb 2010 11:21:43 -0600

On Feb 4, 2010, at 3:43 AM, Bert Groeneveld wrote:

I'm breaking my head about finding some "super algorythm" for this:
I want to correct AGE_INFO, by omitting the days of the weekend (saturday and sunday)

An interesting little math problem. I think this works ...

on workDaysOld(aDate)
set adjDate to date (date string of aDate)
set adjCurrDate to date (date string of (current date))
set actualDaysOld to ((adjCurrDate - adjDate) div days)


set weeksOld to (actualDaysOld div 7)
set remainingDays to (actualDaysOld mod 7) as integer
set todaysIndex to (weekday of adjCurrDate as integer)


todaysIndex - remainingDays
if the result < 1 then
set remainingDays to (remainingDays - 2)
else if the result = 1 then
set remainingDays to (remainingDays - 1)
end if


return ((5 * weeksOld) + remainingDays)
end workDaysOld

Test it and let us know.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Correcting AGE_INFO (From: Bert Groeneveld <email@hidden>)

  • Prev by Date: Re: Correcting AGE_INFO
  • Next by Date: Re: Correcting AGE_INFO
  • Previous by thread: Re: Correcting AGE_INFO
  • Next by thread: Re: Correcting AGE_INFO
  • Index(es):
    • Date
    • Thread