Difference in differences estimation using a regression

Difference in difference estimation implies calculating (P2-P1)-(S2-S1). That would give the result of the treatment.
It seems to me that the estimation is valid for a specific time point, time 2 at this example.
I have read however (for example, at wikipedia), that DiD estimation can be estimated using a regression model
Where Y(ist) is the dependent variable , γ(s) is a dummy for the control\treatment group, λ(t) is a dummy for the before\after period. D(st), afaik, is a dummy variable that equals 1 if a person is in the treatment group, AND if the time is after the treatment time.

What I don't understand however is the equivalence between the two. While the first form is supposed to calculate difference-in-differences estimator between two specific time points, the regression formulation takes into account all the time points after the treatment. So it seems that the regression will somehow fit the estimator to all the points after the treatment period, rather take a specific point, and estimate DiD based upon it.

Am I wrong?
Thank you