Start a conversation

Date and time difference templates

  • Calculate the difference between two dates

    There are multiple options to calculate the difference between dates. 1. getDateDiff The easiest approach is to use getDateDiff. See this calculation: getDateDiff('{date2}','{date1}','y') In this calc...

  • Calculate time difference between two time fields

    Time difference between two time fields on the same day To calculate the difference between two time fields in hours, minutes, or seconds, use the following formula: getTimeDiff('{time_variable_2}', '...

  • Calculate the age using a date variable

    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 form...

  • Calculate the age using a year (or year and month) variable

    As a full birth date might be considered personally identifiable information, using only the birth year or year and month of birth is a good alternative. It is still possible to calculate the age from...

  • Check if the difference between two dates is between limits

    This template checks if after the patient signed informed consent (date1) a visit has taken place (date2) between a day range.  In this template: date1 and date2 are two date fields in your form. Repl...

  • Calculate time difference in seconds (using text fields)

    Time fields in Castor only capture hours and minutes. If you want to capture time in the format HH:mm:ss, you need to use text fields. However, you can calculate with those as well! To calculate the d...