• 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: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.

  • Prev by Date: Re: Making Labels in Quark
  • Next by Date: Re: Number of days left in the month
  • 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