• 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: Subtract 1 month from date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subtract 1 month from date


  • Subject: Re: Subtract 1 month from date
  • From: Nigel Garvey <email@hidden>
  • Date: Thu, 9 Dec 2004 16:04:20 +0000

kai wrote on Thu, 9 Dec 2004 04:45:38 +0000:

>The last line assumes you're running in Panther (which I'm currently
>not - so I'm just guessing how it might work). Alternatively, and
>borrowing blatantly from Nigel's suggestion, this may do it:
>
>---------------------
>
>on firstOfMonthUS(d)
>	copy d to b
>	set b's month to January
>	((b - 2500000 - d) div -2500000 as string) ¬
>		& "/1/" & d's year
>end firstOfMonthUS

Neat! Hard-wiring the "/1/" into the handler. :-)  With that, the rest
can be done with just one line:

  tell (current date) to set searchrange to ¬
	   my firstOfMonthUS(it - day * days) & "..." & my firstOfMonthUS(it)


NG
 _______________________________________________
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

  • Follow-Ups:
    • Re: Subtract 1 month from date
      • From: Eric Geoffroy <email@hidden>
  • Prev by Date: OSX script problem
  • Next by Date: Re: Indexing the month
  • Previous by thread: Re: Subtract 1 month from date
  • Next by thread: Re: Subtract 1 month from date
  • Index(es):
    • Date
    • Thread