Craig Hoyt asked: > Hi all, since it seems slow I thought I'd see if anyone has a routine to > find the number of days between two dates. Craig, Here's another candidate that handles direct numerical date input (easily modified for string input) for a huge range of dates with no Y2K or leap year problem. The function converts any Julian date into an AstroDate (a double ) which can than be manipulated in several ways as demonstrated below. Ken /* The AstroDay function is a modified version of the Julian date formula used by astronomers. Leap years are accurately handled by this function. A leap year is defined as all years divisible by 4, except for years divisible by 100 that are not also divisible by 400. Years divisible by 400 are leap years. 2000 is a leap year. 1900 is not a leap year. This function covers a wide range of dates. The function does not present a Y2K-- or Y3K for that matter -- problem. With the included AstroWeekDay function, you can input an AstroDay number and determine what day of the week any given days falls on. FB^3 code by Ken Shmidheiser Somerset, KY 5-9-2003 */ clear local mode dim as double y local fn AstroDay#( inyear as int, inmonth as int, inday as int ) y = inyear+(inmonth-2.85)/12 end fn = fix(fix(fix(367*y)-1.75*fix(y)+inday)-.75*fix(.01*y))+1721119 /* The AstroWeekDay function returns the day of the week, Sunday through Monday, for any given AstroDay. The astroDay parameter must be a day number returned by the AstroDay function. */ local fn AstroWeekDay$( astroDay as double ) dim as integer weekdayx dim as str15 dayStr weekdayx = ( astroDay - 3 ) Mod 7 select case weekdayx case 0 : dayStr = "Sunday" case 1 : dayStr = "Monday" case 2 : dayStr = "Tuesday" case 3 : dayStr = "Wednesday" case 4 : dayStr = "Thursday" case 5 : dayStr = "Friday" case 6 : dayStr = "Saturday" end select end fn = dayStr print fn AstroDay#( 2002, 9, 11 ) - fn AstroDay#( 2001, 9, 11 ) // prints 365 /* The number of days between February 28, 12000 and March 1, 12000 is 2 because the year 12000 is a leap year as in: */ print fn AstroDay#( 12000, 3, 1 ) - fn AstroDay#( 12000, 2, 28 ) // prints 2 print fn AstroDay#( -12400, 3, 1 ) - fn AstroDay#( -12400, 2, 28 ) // prints 2 print fn AstroDay#( 12000, 3, 1 ) - fn AstroDay#( -12000, 2, 28 ) // prints 8765822 print fn AstroDay#( 1902, 2, 28 ) - fn AstroDay#( 1898, 3, 1 ) // prints 1459 days print fn AstroWeekDay$( fn AstroDay#( 2003, 5, 9 )) // prints Friday print fn AstroWeekDay$( fn AstroDay#( 1993, 12, 1 )) // prints Wednesday print fn AstroWeekDay$( fn AstroDay#( 12000, 3, 2 )) // prints Thursday do handleevents until 0