1. Date stuff
"Oktober" is "October" in dutch, guess Im not as awake as I would think,
when I would take the effort to think about it. Oh well... happens..
>yes, we coulda threaded an algorithm that divided
>by ten if it was over ten and checked the remainder
>against 1 & 2 & 3; but, i didn't feel like it. do you?
Well, it aint *that* hard:
replace the 'add day' section with:
-- Add day
text = text & sprintf (" %d", {date_seq[3]})
day = remainder (date_seq[3],10)
if day = 1 then
text = text & "st"
elsif day = 2 then
text = text & " nd"
elsif day = 3 then
text = text & " rd"
else
text = text & "th"
end if
--
Ralf
2. Re: Date stuff
>>Hawke':
>>yes, we coulda threaded an algorithm that divided
>>by ten if it was over ten and checked the remainder
>>against 1 & 2 & 3; but, i didn't feel like it. do you?
Ralf:
>Well, it aint *that* hard:
>replace the 'add day' section with:
well, ;), if i may use your words against you:
>guess Im not as awake as I would think,
>when I would take the effort to think about it.
*runs, ducks, and hides*
3. Re: Date stuff
- Posted by Irv Mullins <irv at ELLIJAY.COM>
Oct 26, 1998
-
Last edited Oct 27, 1998
Actually, Ralf, you can avoid building that text string,
by doing it as follows:
-- rldate.e------------
constant
DAYS = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},
MONTHS = {"January","February","March","April","May","June",
"July","August","September","Oktober","November","December"},
PF = {"st","nd","rd","th"}
global function rldate ()
sequence date_seq, post
date_seq = date ()
if remainder(date_seq[3],10) < 4 then
post = PF[date_seq[3]]
else post = PF[4]
end if
return sprintf("%s %s %d%s, %4d",
{DAYS[date_seq[7]], MONTHS[date_seq[2]], date_seq[3],
post, date_seq[1]+1900})
end function
-- end of rldate.e---------------
puts(1,rldate())
4. Re: Date stuff
>Actually, Ralf, you can avoid building that text string,
>by doing it as follows:
Indeed, Irv. This is the most clean approach yet.. and I suspect it will be
faster as well.
Interesting consider the length of the original rldate () by Matt.
>-- rldate.e------------
>
>constant
>DAYS =
>MONTHS = {"January","February","March","April","May","June",
> "July","August","September","Oktober","November","December"},
>PF = {"st","nd","rd","th"}
>
>global function rldate ()
>sequence date_seq, post
>
> date_seq = date ()
> if remainder(date_seq[3],10) < 4 then
> post = PF[date_seq[3]]
> else post = PF[4]
> end if
> return sprintf("%s %s %d%s, %4d",
> {DAYS[date_seq[7]], MONTHS[date_seq[2]], date_seq[3],
> post, date_seq[1]+1900})
>
>end function
>
>-- end of rldate.e---------------
>
> puts(1,rldate())