I'd considered something similar, but then you have to deal with another bug. Since your code uses a timespan, you're limited to math of less than about 181yrs since timespans have a ludicrously low limit of 65535 days (oddly DF uses a Timestamp internally for a Timespan instead of something like an Int64). DateAddDays can go back in time to about the year 100 without a problem (as long as you analytically fix the leap day problem). Of course, DateAddDays as it is right now has a sub-limit as well since it can only work with years < 2500. Basically Dates and Datetimes are screwy every way to Sunday in DataFlex.