• 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: Counting & trashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counting & trashing


  • Subject: Re: Counting & trashing
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 14 Jul 2004 19:10:32 +0100

In my message of Wed, 14 Jul 2004 14:54:10 +0100, I wrote:

(A hander to convert any date from 9999 BC to 9999 AD to string)

> on dateAsString(theDate)
> set dateStr to theDate as string
> -- 5.04911232E+10 seconds is 2000 years
> if theDate comes before (date "Monday, 1 January 2001 00:00:00") -
>5.04911232E+10 then
> set spc to (offset of ((theDate's year) as string) in dateStr) + 4
> set dateStr to text 1 thru spc of dateStr & "BC" & text spc thru -1
>of dateStr
> end if
> return dateStr
> end dateAsString

Hmmm. I seem to have committed one error and one oversight here. This is
better:

on dateAsString(theDate)
set dateStr to theDate as string
-- 6.3113904E+10 seconds is 2000 years
if theDate comes before (date "Monday, 1 January 2001 00:00:00") -
6.3113904E+10 then
set yearStr to text 2 thru 5 of (((theDate's year) + 10000) as
string)
set spc to (offset of yearStr in dateStr) + 4
set dateStr to text 1 thru spc of dateStr & "BC" & text spc thru -1
of dateStr
end if
return dateStr
end dateAsString

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


  • Prev by Date: Re: User Permissions
  • Next by Date: RE: How to choose a specific scripting addtion's terms
  • Previous by thread: Re: Counting & trashing
  • Next by thread: Re: Counting & trashing
  • Index(es):
    • Date
    • Thread