Re: Counting & trashing
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.