Re: Correcting AGE_INFO
Re: Correcting AGE_INFO
- Subject: Re: Correcting AGE_INFO
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 4 Feb 2010 11:35:45 -0500
On Thu, Feb 4, 2010 at 5:21 AM, Bert Groeneveld
<email@hidden> wrote:
> Hello Mark, thanks for your answer.
> Would you be so kind to put that into a real code block for me?
Sure, try this:
on business_days from startDate to endDate
repeat while startDate's weekday is in {Saturday, Sunday}
set startDate to startDate + 1 * days
end
repeat while endDate's weekday is in {Saturday, Sunday}
set endDate to endDate - 1 * days
end
set difference to round ((endDate - startDate)/days) rounding up
set weekends to difference div 7 * 2
set extra to difference mod 7
repeat while extra > 0
set endDate to endDate - 1 * days
if endDate's weekday is in {Saturday, Sunday} then
set weekends to weekends + 1
end
set extra to extra - 1
end repeat
return difference - weekends
end business_days
set startHere to date "Tuesday January 26 2010 () 16:38:43"
set endHere to date "Thursday February 4 2010 () 16:38:43"
business_days from startHere to endHere -- 7
business_days from (startHere + 1 * days) to endHere -- 6
--
Mark J. Reed <email@hidden>
_______________________________________________
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