how does my doctor know how far along I am?

so how can my doctor know how far along I am if I'm not sure when my last period was?