The finite horizon stochastic knapsack combines a secretary problem with an integer knapsack problem. It is useful for optimizing sales of perishable commodities with low marginal costs to impatient customers. Applications include yield management for airlines, hotels/motels, broadcasting advertisements, and car rentals. In these problems, K types of customers arrive stochastically. Customer type, k, has an integer weight wk, a value bk, and an arrival rate λk(t) (which depends on time). We consider arrivals over a continuous time horizon [0, T] to a ‘knapsack’ with capacity W. For each arrival that fits in the remaining knapsack capacity, we may (1) accept it, receiving bk, while giving up capacity wk; or (2) reject it, forgoing the value and not losing capacity. The choice must be immediate; a customer not accepted on arrival is lost. We model the problem using continuous time, discrete state, finite horizon, dynamic programming. We characterize the optimal return function and the optimal acceptance strategy for this problem, and we give solution methods. We generalize to multidimensional knapsack problems. We also consider the special case where wk = 1 for all k. This is the classic airline yield problem. Finally, we formulate and solve a new version of the secretary problem.