• 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: numeric date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: numeric date


  • Subject: Re: numeric date
  • From: Emmanuel <email@hidden>
  • Date: Sat, 19 Jul 2003 19:15:44 +0200

At 12:51 PM +0200 19/07/03, email@hidden wrote:
> >At 11:08 AM +0200 19/07/03, email@hidden wrote:
>>>The script below does the job, but does anybody have a better solution?
>
>>>set d to (current date) as text
>>>set m to word 2 of d
>>>set y to "January February March April May June July August September October November December"
>>>repeat with x from 1 to 12
>>> if word x of y is equal to m then exit repeat
>>>end repeat
>>>set m to x as text
>>>if length of m < 2 then set m to "0" & m
>>>set d to word 4 of d & "." & m & "." & word 3 of d
>
>>What's wrong with yours?
>
>It runs okay but I thought there could be simpler solutions.

Here is what is sometimes advised:

set d to (current date)
copy d to j
set month of j to January
set x to 1 + (d - j) div (28 * days)

it's only a bit shorter.

Oh, getting "word 2 of d" is no good, you should say "month of d as text" instead.

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

References: 
 >Re: numeric date (From: email@hidden)

  • Prev by Date: Re: numeric date
  • Next by Date: iPhoto: getting exposure information
  • Previous by thread: Re: numeric date
  • Next by thread: Re: numeric date
  • Index(es):
    • Date
    • Thread