In this work, we present a quantitative theory of temporal spike-frequency adaptation in cortical pyramidal cells. Our model pyramidal neuron has two-compartments (a "soma" and a "dendrite") with a voltage-gated Ca2+ conductance (gCa) and a Ca2+-dependent K+ conductance (gAHP) located at the dendrite or at both compartments. Its frequency-current relations are comparable with data from cortical pyramidal cells, and the properties of spike-evoked intracellular [Ca2+] transients are matched with recent dendritic [Ca2+] imaging measurements. Spike-frequency adaptation in response to a current pulse is characterized by an adaptation time constant tauadap and percentage adaptation of spike frequency Fadap [% (peak - steady state)/peak]. We show how tauadap and Fadap can be derived in terms of the biophysical parameters of the neural membrane and [Ca2+] dynamics. Two simple, experimentally testable, relations between tauadap and Fadap are predicted. The dependence of tauadap and Fadap on current pulse intensity, electrotonic coupling between the two compartments, gAHP as well the [Ca2+] decay time constant tauCa, is assessed quantitatively. In addition, we demonstrate that the intracellular [Ca2+] signal can encode the instantaneous neuronal firing rate and that the conductance-based model can be reduced to a simple calcium-model of neuronal activity that faithfully predicts the neuronal firing output even when the input varies relatively rapidly in time (tens to hundreds of milliseconds). Extensive simulations have been carried out for the model neuron with random excitatory synaptic inputs mimicked by a Poisson process. Our findings include 1) the instantaneous firing frequency (averaged over trials) shows strong adaptation similar to the case with current pulses; 2) when the gAHP is blocked, the dendritic gCa could produce a hysteresis phenomenon where the neuron is driven to switch randomly between a quiescent state and a repetitive firing state. The firing pattern is very irregular with a large coefficient of variation of the interspike intervals (ISI CV > 1). The ISI distribution shows a long tail but is not bimodal. 3) By contrast, in an intrinsically bursting regime (with different parameter values), the model neuron displays a random temporal mixture of single action potentials and brief bursts of spikes. Its ISI distribution is often bimodal and its power spectrum has a peak. 4) The spike-adapting current IAHP, as delayed inhibition through intracellular Ca2+ accumulation, generates a "forward masking" effect, where a masking input dramatically reduces or completely suppresses the neuronal response to a subsequent test input. When two inputs are presented repetitively in time, this mechanism greatly enhances the ratio of the responses to the stronger and weaker inputs, fulfilling a cellular form of lateral inhibition in time. 5) The [Ca2+]-dependent IAHP provides a mechanism by which the neuron unceasingly adapts to the stochastic synaptic inputs, even in the stationary state following the input onset. This creates strong negative correlations between output ISIs in a frequency-dependent manner, while the Poisson input is totally uncorrelated in time. Possible functional implications of these results are discussed.