Error calculating weeks & days elapsed
I am calculating the number of weeks & days a woman is pregnant (aka WGA, weeks gestational age), by calculating weeks & days elapsed between start of pregnancy and the date of her prenatal appointment. Start of pregnancy is calculated from her estimated due date (EDDforWGA, a calculated field, date result) minus 280 (length of the average pregnancy in days). The Pregnancies layout contains a Prenatals portal:
Prenatals::WGA = Int ( Dateofprenatal - ( Pregnancies::EDDforWGA - 280 ) / 7 ) & "w" & Mod ( Dateofprenatal - ( Pregnancies::EDDforWGA - 280 ); 7 ) & "d"
The result of the calculation was working, but I'm not sure what I did, as it is now giving a result that is obviously wrong, showing a number hundreds of thousands of weeks pregnant. I did a test to try to find where it is messed up, and I believe it is calculating the first day of pregnancy as being the Year 0001. Could someone tell me what is wrong with my calculation?