Re: Need help with finding first of the month
Re: Need help with finding first of the month
- Subject: Re: Need help with finding first of the month
- From: Nigel Garvey <email@hidden>
- Date: Fri, 2 Jul 2004 01:02:00 +0100
"Young, Rich A." wrote on Thu, 1 Jul 2004 15:00:52 -0500 :
>
I need to add a piece to an existing script that will find how many days it
>
is until the first day of the next month from any given date taking into
>
account things like leap year. Can anyone point me in the right direction
It depends what you mean by "days ... until the first of next month. If
you mean the number of complete 24-hour periods then:
on daysToFirstOfNextMonth(theDate)
tell 33 - (theDate's day) to return it - ((theDate + it * days - 1)'s
day)
end daysToFirstOfNextMonth
daysToFirstOfNextMonth(date "Saturday, 31 July 2004 23:59:59")
--> 0
If you mean the number of times the date changes:
on daysToFirstOfNextMonth(theDate)
tell 32 - (theDate's day) to return it - ((theDate + it * days)'s
day) + 1
end daysToFirstOfNextMonth
daysToFirstOfNextMonth(date "Saturday, 31 July 2004 23:59:59")
--> 1
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.