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

Re: Coerce time


  • Subject: Re: Coerce time
  • From: Nigel Smith <email@hidden>
  • Date: Thu, 21 Aug 2003 11:21:18 +0100

On 20/8/03 20:42, "Rich Carroll" <email@hidden> wrote:

> Is there a simple way to coerce "August 20, 2003" to 08/20/03?

Just to add one more to the mix:

--so you can test
set theDate to date (text returned of (display dialog "" default answer ""))

--we'll find the offset from this list, the bogus first 3 characters just
--saves us from having to add 1 later
set theMonths to "***JanFebMarAprMayJunJulAugSepOctNovDec"

--this is all one line
return ("" & ((offset of (characters 1 thru 3 of (month of <no-break>
theDate as string) as string) in theMonths) div 3) & "/" & <no-break>
day of theDate & "/" & year of theDate)

I'll leave the error catching to you...

Nigel

PS. Someone is going to to mention TIDs, string conversion and why not use
"text of characters 1 thru 3..."

Am I the only person who evaluates:
get text of characters 3 thru 7 of "Try this at home"
...and gets
{"y", " ", "t", "h", "i"}
...contradicting p64 of the ASLG?
_______________________________________________
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: Coerce time
      • From: John Delacour <email@hidden>
References: 
 >Coerce time (From: Rich Carroll <email@hidden>)

  • Prev by Date: Can't save a script without .scpt extension ?
  • Next by Date: Re: Coerce time
  • Previous by thread: Re: Coerce time
  • Next by thread: Re: Coerce time
  • Index(es):
    • Date
    • Thread