Re: Programming using 4GL
Posted in 1993
In article <1pq73oINN8pa@emory.mathcs.emory.edu> RUCHI%CFRVM.BITNET@uga.cc.uga.edu (Ruchi Patel) writes: > > Is there any way I can find out maximum days for the current month? > > e.g 4/5/93 - April has 30 days > Well, there is always the brute force method: CALL days_in_month("4/5/93") FUNCTION days_in_month(p_date) DEFINE p_date DATE DEFINE p_month1, p_month2, p_year1, p_year2, p_days_in_month SMALLINT # LET p_month1 = MONTH(p_date) LET p_year1 = YEAR(p_date) LET p_month2 = p_month1 + 1 IF p_month1 = 13 THEN LET p_year2 = p_year1 + 1 ELSE LET p_year2 = p_year1 END IF LET p_days_in_month = MDY(p_month2, 1, p_year2) - MDY(p_month1, 1, p_year1) RETURN p_days_in_month END FUNCTION