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:08:46 +0800
>
Someone asked (on the A'script newsgroup) how to figure out how many
>
days are left in the current month, or how to compute the total number
>
of days in the current month. I came up with a solution for days left,
>
but it fails for February in leap years; someone else came up with an
>
elegant way for total days in the month. Combining the two gets the
>
following to compute the number of days remaining in a month.
Michelle,
Would you try this one:
-- handler copied from somewhere
on dmyList(theDate)
copy {theDate, January} to {newDate, newDate's month}
set mm to (1 + ((theDate) - newDate) div 2419200)
return {theDate's day, mm, theDate's year}
end dmyList
set cDMY to my dmyList(current date)
-- below code in one line,
-- need to adjust the sequence according to your Date & Time preference
set endOfCurrentMonth to item 1 of my dmyList((date ("01" & "-" & (item 2 of
cDMY) + 1 & "-" & item 3 of cDMY)) - 1 * days)
set daysLeft to endOfCurrentMonth - (item 1 of cDMY)
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.