• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Number of days left in the month
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Number of days left in the month
  • Next by Date: Re: Digesting the digests ... (was: OK - so who ate my digests?)
  • Previous by thread: Re: Number of days left in the month
  • Next by thread: Re: Number of days left in the month
  • Index(es):
    • Date
    • Thread