Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • CDMS
  • Castor CDMS Calculations Manual
  • Date and time difference templates

Calculate the age using a date variable: EDC/CDMS

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • CDMS
    Castor CDMS Manual Castor CDMS Calculations Manual Frequently Asked Questions Articles for Data Managers Castor CDMS Compliance Release Documents
  • eConsent
    Castor eConsent Manual Castor eConsent Compliance Release Documents
  • SMS
    Castor SMS Manual Castor SMS Compliance Release Documents
  • Castor Connect
    Castor Connect Compliance Release Documents Castor Connect Manual Castor Connect - Participant Quick Start Guide
  • Helpdesk
    News Other Resources Castor products knowledge resources
  • Status page
  • Completing a Study
+ More

There are multiple ways to calculate the age using dates. Here are some examples:

Calculate current age (today's age)

If you only have one date variable (date of birth), you can use the following formula:

var d = new Date();
var datestring = d.getDate() + "-" + (d.getMonth()+1) + "-" + d.getFullYear();
getDateDiff(datestring,'{dob}','y');

In this calculation {dob} is the birth date variable (in the DD-MM-YYYY format). Replace this with your own variable name.

Note:The above formula calculates the current age from only one date field and will always be updated when the step is opened in a record.

Calculate the age on a certain date

If you are using two date variables, e.g. date of birth and date of admission, you can use the following formula:

getDateDiff('{date_admission}','{dob}','y');

In this calculation {date_admission} is the admission date and {dob} is the birth date variable (in the DD-MM-YYYY format). Replace these with your own variables.

date calculation determine age

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Calculate the difference between two dates: EDC/CDMS
  • Calculate time difference between two time fields: EDC/CDMS
  • Calculate the age using a year or year and month variable: EDC/CDMS
  • Calculate time difference in hh:mm:ss (using text fields): EDC/CDMS
ISO 27001
FDA - 21 CFR part 11
ICH GCP compliant
HIPAA compliant
CDISC
ISO 9001
gdpr compliant

Products & Industries

  • Electronic Data Capture (EDC)
  • ePRO
  • eConsent
  • Decentralized Clinical Trials (DCT)
  • Clinical Data Management
  • Medical Device & Diagnostics
  • Biotech & Pharma
  • CROs
  • Academic Research

Resources

  • Thought Leadership
  • Blog
  • Castor Academy
  • Knowledge Base

 

Company

  • About Us
  • Careers
  • News
  • Contact Support
  • Contact Us

Legal & Compliance

  • Terms of Use
  • Privacy & Cookie Statement
  • Responsible Disclosure Policy
  • Good Clinical Practice (GCP)
  • ISO Compliance Certificates
  • GDPR & HIPAA Compliance
  • Security Statement

© 2022, Castor. All Rights Reserved.

Follow us on social media


Knowledge Base Software powered by Helpjuice

Definition by Author

0
0
Expand