• 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: Create a folder with today's date as the folder name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create a folder with today's date as the folder name


  • Subject: Re: Create a folder with today's date as the folder name
  • From: has <email@hidden>
  • Date: Sun, 10 Feb 2002 13:18:34 +0000

Gnarlodious wrote:

>on GetMonthNumber()
> set theDate to (current date)
> copy theDate to b
> set the month of b to January
> return 1 + (theDate - b + 1314864) div 2629728
>end GetMonthNumber

Out of interest... I was poking around looking for the fastest way of
getting a month as integer (French Vanilla [above], iterating across a list
of months looking for a match, etc) and found the following to be quickest
overall:

======================================================================

on monthToInteger(theMonth)
if theMonth is January then return 1
if theMonth is February then return 2
if theMonth is March then return 3
if theMonth is April then return 4
if theMonth is May then return 5
if theMonth is June then return 6
if theMonth is July then return 7
if theMonth is August then return 8
if theMonth is September then return 9
if theMonth is October then return 10
if theMonth is November then return 11
if theMonth is December then return 12
error "Invalid value (not a month)."
end monthToInteger

======================================================================

Not beautiful, but it's faster than the FV method on the first 10 months
(and much faster than the list iteration method).

I think someone also came up with a simplified FV method a while back - I'd
be interested in comparing that for speed if anyone has it.

Cheers

has
_______________________________________________
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.

  • Follow-Ups:
    • Re: Create a folder with today's date as the folder name
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: date 0
  • Next by Date: Re: date 0
  • Previous by thread: Re: Create a folder with today's date as the folder name
  • Next by thread: Re: Create a folder with today's date as the folder name
  • Index(es):
    • Date
    • Thread