How long does a diffusing molecule spend in a close vicinity of a confining boundary or a catalytic surface? This quantity is determined by the boundary local time, which plays thus a crucial role in the description of various surface-mediated phenomena such as heterogeneous catalysis, permeation through semi-permeable membranes, or surface relaxation in nuclear magnetic resonance. In this paper, we obtain the probability distribution of the boundary local time in terms of the spectral properties of the Dirichlet-to-Neumann operator. We investigate the short-time and long-time asymptotic behaviors of this random variable for both bounded and unbounded domains. This analysis provides complementary insights onto the dynamics of diffusing molecules near partially reactive boundaries.