Re: Simple date question
Re: Simple date question
- Subject: Re: Simple date question
- From: Andrew Oliver <email@hidden>
- Date: Tue, 15 Mar 2005 11:02:36 -0800
On 3/15/05 10:40 AM, "Bernardo Hoehl" <email@hidden> wrote:
> Hi List,
>
> This is a simpe one:
>
> How do I get the last day of the current month?
>
> Example: february 2005 = 28 or March =31
One trick is to add sufficient days to the current date to force you into
the next month, the subtract back a sufficient number of days, like:
set cd to (get current date)
--> date "Tuesday, March 15, 2005 11:00:00 AM"
set day of cd to 32
-- this forces you to some day in the next month
-- since no month has more than 31 days
--> date "Friday, April 1, 2005 11:00:00 AM"
set day of cd to 1
--> reset back to the first of the month
--> date "Friday, April 1, 2005 11:00:00 AM"
set cd to cd - (1 * days)
-- subtract one day gets the last day of the preceding month
--> date "Thursday, March 31, 2005 11:00:00 AM"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden