days in month--in 4gl
Posted in 1993
Here's how I do it. Write a function that knows how long each month is. For example, function days_in_month(selected_date) define selected_date datetime year to day case when month(selected_date) = 1 return 31 when month(selected_date) = 2 return days_in_feb(selected_date) when month(selected_date) = 3 return 30 . . . The function days_in_feb has to deal with leap years function days_in_feb(selected_date) define selected_date date_time year to day, yearx smallint let yearx = year(x_date) if (yearx mod4)=0 and (rearx mod100) <> 0 then if (yearx mod 400) !=0 then return 29 end if end if return 28 end function -- -------------------------------------------------------------- Paul Mahler internet: pmahler@netcom.com Data Based Systems, Inc. Database Systems Development 1800 Market St. #257 voice: 415.518.8459 San Francisco, CA 94102 "I work for myself; there's no one else to blame it on." -------------------------------------------------------------