Most due dates are calculated from the first day of the last menstrual period (LMP). It is assumed that conception took place at 14 days after the LMP and that cycles are 28 days in length.
Not everyone has a 28 day cycle and what you are given as a due date may vary from one practitioner to another.
Ultrasound is most accurate when done earlier in the pregnancy.
Naegele's Rule is a quick way to determine your due date (assuming a 28 day cycle with ovulation at 14 days) is to add seven days to your LMP and minus three months.
Or you could subtract 7 days from your known conception date and minus three months.
The following link is from the Association of Ontario Midwives: