Re: Number of days left in the month
Re: Number of days left in the month
- Subject: Re: Number of days left in the month
- From: bill <email@hidden>
- Date: Thu, 21 Nov 2002 11:43:58 +0800
Michelle,
Sorry, my previous suggestion has a serious flaw, please try this one:
-- again, copied somewhere
on getMonths(theDate)
copy theDate to b
set the month of b to January
return (1 + (theDate - b + 1314864) div 2629728)
end getMonths
on endOfMonth(theDate)
if my getMonths(theDate) is in {1, 3, 5, 7, 8, 10, 12} then
return 31
else if my getMonths(theDate) is in {4, 6, 9, 11} then
return 30
else
return day of ((date ("01-03-" & (year of theDate))) - 1 * days)
end if
end endOfMonth
my endOfMonth(current date)
-- 30
By the way, if you use OS X, the getMonths handler can be replaced by:
(do shell script "date +%m") as integer
Bye
bill
_______________________________________________
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.