Last day of month....
Last day of month....
- Subject: Last day of month....
- From: David Crowe <email@hidden>
- Date: Wed, 20 Nov 2002 22:21:33 -0700
Here's a 1 line script that determines the last day of the month
without try blocks ... and in one line too!
set LastDayOfMonth to 27 + ((((date " March 1, 2003") - (date
"February 28, 2003")) / (24 * 3600)) as integer)
This will work with any consecutive months. It works from the
observation that if the first day of the following month is 1 day
greater than the 28th of the previous month, the month has 28 days.
If the first day is 2 days greater, the previous month has 29 days
etc.
Obviously, it's more useful when the date is a variable.
The try block is avoided by comparing the 1st and the 28th of the
months, days which always exist.
You can check it out by changing "2003" to "2004"
- David Crowe
_______________________________________________
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.