>I must say I'm a little disappointed at the muted reaction to my
>revelation of "English Fudge". Still, that's given me a little time to
>refine it. ;-) As posted yesterday:
Oh, dear! Here's a handler which uses the newest technique for
everyone to put into their date/time libraries. It returns the
current month number or the month number of the date it was passed.
Because the date conversion is so smart you can throw anything at it.
Typical uses:
monthNumber(October) -- convert class month to number
monthNumber(0) -- return current month number
monthNumber({}) -- return current month number
monthNumber("") -- return current month number
monthNumber("Feb") -- convert string to number
monthNumber("23/6") -- convert string to number
monthNumber("5 Feb") -- convert string to number
on monthNumber(theDate)
-- obtain the month number from a date
-- returns current month when date theDate doesn't work
-- eg, monthnumber(0) --> returns current month number
-- parameters: anything
-- French Vanilla / English Fudge
-- Emmanuel / Nigel Garvey
-- May 2003
try
set theDate to date (theDate as string)
on error --
set theDate to the current date
end try
copy theDate to b
set b's month to January
return (b - 2500000 - theDate) div -2500000
end monthNumber
--
--
Malcolm Fitzgerald [log in to unmask]
Database Manager http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530