Number of days left in the month
Number of days left in the month
- Subject: Number of days left in the month
- From: Michelle Steiner <email@hidden>
- Date: Wed, 20 Nov 2002 10:21:43 -0700
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.
GetDaysInCurrentMonth() is his; the date arithmetic is mine.
--Michelle
set this_month to month of (current date)
set next_Month to (date (this_month as string)) +
((GetDaysInCurrentMonth() * days) as string)
set days_remaining to ((next_Month - (current date)) / (1 * days)) div 1
on GetDaysInCurrentMonth()
set s to "31"
try
date s
return s
end try
set s to "30"
try
date s
return s
end try
set s to "29"
try
date s
return s
end try
return "28"
end GetDaysInCurrentMonth
--Michelle
We're not human beings having a spiritual experience.
We're spiritual beings having a human experience.
_______________________________________________
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.