Link to home
Start Free TrialLog in
Avatar of Steynsk
SteynskFlag for Netherlands

asked on

Calculate the age and corrected age of prenatal patients

Hi Experts,

I’ve got to calculate the age and corrected age of a selection of prenatal patients from our prenatal department.

The corrected age is the age a child would have if it would have been born after a full pregnancy of 280 day (40 weeks).

What do we know?

We do know the:

•      birth date (stored in a nvarchar field) name “geboortedatum”  format yyyy-mm-dd
•      pregnancy weeks (stored in a nvarchar field)  name “Zwangerschapsduur_weken” format example “27”
•      pregnancy days (stored in a nvarchar field)  name “Zwangerschapsduur_dagen” format example “4”

We need to know (based on the current date):

•      The current uncorrected age (based on the birth date) precise by the day.
•      The corrected age precise by the day.
•      The number of days between the uncorrected and corrected age.

Besides the points you will receive our hospitals gratitude for your contribution to public healthcare in the Netherlands.
Avatar of peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

The number of days difference is just..

280- (Zwangerschapsduur_weken*7) - Zwangerschapsduur_dagen
Avatar of Swindle
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

I'm going to write some tips for you that might help:

1. to get current uncorrected age [Select datediff(day, birthdate, getdate()) from ...... ]

2. to get the corrected age:
   - get the start pregnancy date = birth_date - pregnancy days in sql ' set @birthdate = dateadd(d, birthdate , -1* pregnancy days)'
   - get the estimated_birth_date = start_date + 240 day in sql ' set @estbirth_date = dateadd(d, startdate,240)'
   - select @corrected_age = getdate()-estbirth_date

3. just subtract the two dates above.

- To get current date "today" use getdate()

- Date time functions help:
Avatar of Steynsk


Sorry Peter,

I'm used to do only simple select statements and don't understand.
Can you please give a more detaild discription what I should do?

Avatar of Steynsk


Dear Swindle,

This is exact what we were looking for. Thank you very much you helped us a great deal.