Part of Business rules supporting information
Performing calculations using dates
Some of the dates specified for use in the dataset may be used to inform the data extracts or used within the rules which make up each indicator or count.
- where information from a set date is required this means all information from midnight (00:00:00) on that date
- when information up to and including a set date is required, this is taken as meaning up to midnight (23:59:59) on that date. This means that all activity on that date, regardless of time, will be processed
- where date criteria are specified with intervals of multiples of months or years these should be interpreted as calendar months or calendar years
- a week should be treated as 7 consecutive days
- where activity is required within a month of a ‘moving date’ (that is a date which may not necessarily fall on the first or last day of a month such as date of birth or a vaccination date) this is usually written as plus or minus 31 days per month, as agreed by NHS England
Date calculation examples
Some examples of how to use these dates in calculations can be seen below:
| Date | Example | Description of calculation method |
|---|---|---|
| From or start dates | >= QSSD | This example is looking for information on or after the specified date, therefore this example would look for activity taking place from the start of that day, so on or after the time of midnight (00:00:00) on the QSSD |
| To or end dates | <= ACHV_DAT | This example is looking for information up to and including the specified date, therefore this example would look for activity taking place up to the end of that day, so up to and including the time of 23:59:59 on the achievement date. This means information effective on the achievement date will be included but information on or after midnight (00:00:00) the following day will be excluded. |
| Patient age | Patients age (years) at ACHV_DAT |
This example would look for patient age in full years at the end of the day (23:59:59) on the achievement date. For example. if a patient was born on 30 April 2005 and the achievement date is 30 April 2015 then this calculation would return a result of 10 years, regardless of what time of day the patient was born. If patient age is calculated on a set date but that date is before the patient was born, then the intention is that a 0 (zero) value is returned rather than a NULL value or a negative. |
| Data range in years | PAT_DOB + 5 years |
If an event is required within a number of years of a ‘moving date’ (that is a date which may not be the end of a calendar month such as date of birth or a vaccination date) this is usually written in years and equates to one calendar year. In this example the date 5 calendar years following the patient’s date of birth would be returned, For example if PAT_DOB was 1 July 2015 the date returned would be 1 July 2020. If PAT_DOB was 15 July 2015 the date returned would be 15 July 2020. If PAT_DOB was 31 July 2015 the date returned would be 31 July 2020. Regardless of whether the PAT_DOB happens to fall on the first day, the last day or in the middle of a month, the calculation always looks 5 calendar years ahead (in this example). |
| Date range where the date is a fixed date at the end of a month. | (ACHV_DAT – 1 month) |
Where dates are specified in months this refers to one calendar month. As the achievement date is usually the last day of a month, this example would calculate the last day of the previous calendar month. For example 1) if achievement date was 30 April, this example would return 31 March. For example 2) if achievement date was 31 March, this example would return 28 February (or 29 February in a leap year). |
| Activity within date range where the date is a fixed date at the end of a month. | VACCINE_DAT > (ACHV_DAT – 1 month) |
This example would look for activity within or after the 1 month period leading up to the achievement date. For example if achievement date was 30 April, this example would return activity after 23:59:59 on 31March (so activity from 00:00:00 on 1 April). This type of calculation could be treated the same as “VACCINE_DAT >= ((ACHV_DAT + 1 day) – 1 month)” where the result would also be activity from 00:00:00 on 1 April. |
| Date range where reference date is not a fixed date at the end of the month. | (PAT_DOB + 1 month) | This example would calculate the date 1 calendar month after the PAT_DOB. As the PAT_DOB could be at any point during the month, this example would calculate the same day of the next month.For example if PAT_DOB was 10 April, this example would return 10 May. If the PAT_DOB does fall on the last day of a month or on a day where there is no corresponding date for the next month (for example 29, 30 and 31 January) then this example would calculate the ‘closest’ valid date (29, 30 or 31 January + 1 calendar month = 28 or 29 February in a leap year). |
| Activity within date range where reference date is not the end of a month. | ASSESSMENT_DAT > (TREATMENT_DAT – 1 month) |
This example would look for activity within (or after) the 1 month period leading up to the TREATMENT_DAT. For example 1) if TREATMENT_DAT was 10 April, this example would return activity after 23:59:59 on 10 March (activity from 00:00:00 on 11 March). For example 2) if TREATMENT_DAT was 30 April, this example would return activity after 23:59:59 on 31 March (activity from 00:00:00 on 1 April). This type of calculation could be treated the same as “ASSESSMENT_DAT >= ((TREATMENT_DAT + 1 day) – 1 month)” where the results would also be 1) activity from 00:00:00 on 11 March and 2) activity from 00:00:00 on 1 April. If the TREATMENT_DAT does fall on the last day of a month or on a day where there is no corresponding date for the previous month for example 29, 30 and 31 March) then this example would calculate the ‘closest’ valid date (29, 30 or 31 March - 1 calendar month = 28 Feb or 29 Feb in a leap year). |
| Date range in days | VAC_DAT – 31 days |
If an event is required within a month of a ‘moving date’ (that is a date which may not be the end of a calendar month such as date of birth or a vaccination date) this is usually written as plus or minus 31 days and should be calculated in days. In this example the date 31 days prior to the VAC_DAT date would be returned. For example 1) if VAC_DAT was 31 July the date returned would be 30 June. for example 2) if VAC_DAT was 15 May the date returned would be 14 April. for example 3) if VAC_DAT was 1 May the date returned would be 31 March. Regardless of whether the VAC_DAT happens to fall on the first day, the last day or in the middle of a month, the calculation always looks 31 days backwards (in this example). |
| Calculations involving dates of birth on or near 29 February | PAT_DOB + 1 year |
When calculating the age of a patient born on 29th February then in non-leap years the patient’s birthday is considered to be 1st March. If a patient’s date of birth falls on 29 February in a leap year, then the corresponding date one year afterwards or one year beforehand is 1 March. For example 1) If PAT_DOB was 29 February 2016 then PAT_DOB + 1 year is 1 March 2017 and PAT_DOB – 1 year is 1 March 2015. For example 2) If PAT_DOB was 29 February 2016 then PAT_DOB + 4 years is 29 February 2020. For periods of time which are not multiples of 1 year (For example months) then standard rules for dates which are not fixed dates at the end of a month apply. If PAT_DOB is on 28 February or 1 March and applying a date calculation results in looking forward into a leap year, such as 2016, then the date returned would still be 28 February or 1 March. For example if PAT_DOB was 28 February 2015 then applying PAT_DOB + 1 year would return a date of 28 February 2016. if PAT_DOB was 1 March 2015 then applying PAT_DOB + 1 year would return a date of 1 March 2016. |
If a data item has a NULL value and is used in the qualifying criteria of another data item, then the dependant data item fields will also be NULL as dates cannot be checked against a NULL value.
For example, if the dataset qualifying criteria is looking for an intervention which took place after a test and the patient has no test date, then it is not possible to check whether an intervention took place after the test. This means the intervention field for this patient will also be NULL.
Calculating date of birth ranges for eligible populations
The business rules do not routinely specify ranges of dates of birth of eligible patients as they are not required for the extract. As such these date ranges are not provided by NHS England unless specifically requested by the customer. Individuals or organisations wishing to independently calculate date ranges for their own use can use the logic in the business rules.
For example; In the seasonal influenza v11.0 business rules for the 2025-26 service year, the cohort ‘SFLUCX001’ has the following logic:

This logic uses the value from the field PAT2_AGE outlined in the clinical data extraction criteria table, where PAT2_AGE is defined as the age of the patient at the QSED, as shown in the image below.

The QSED is defined in the qualifying dates table as follows:

So far, it is understood that the patients age in full years on 31 March 2026 must be 65 or over, therefore patients must have been born at least 65 years before 31 March 2026.
- a patient born on 31 March 1961 would have their 65th birthday on 31 March 2026 and therefore PAT2_AGE would be 65 for this patient so the patient would be included in the cohort ‘SFLUCX001’
- a patient born one day earlier on 30 March 1961 would have already turned 65 years old by 31 March 2026 so PAT2_AGE would be 65 and this patient would be included in this cohort
- a patient born one day later on 1 April 1961 would have a PAT2_AGE of 64 so this patient would not be included in this cohort
From this information it can be determined that any patient born on or before 31 March 1961 would meet the criteria of being aged 65 years or over on 31 March 2026 and would therefore be included in the cohort for this service year.
For readers who are confident using Microsoft Excel, the age on certain dates can be calculated using a DATEDIF formula. This formula is written in the following way:
=DATEDIF(<cell containing later of two reference dates for example QSED>,<cell containing earlier of two reference dates for example DOB>,<format for example “y” for years, “m” for months>)
For example

In the image above the QSED is specified in cell B1 and a date of birth is specified in cell B2. The DATEDIF formula is specified in cell B4 in the following way:
=DATEDIF(B2,B1,”y”)
When the chosen format is “y” then this formula calculates the number of whole calendar years between the two dates in cell B4.
Changing the DOB will allow the user to see what the age of the patient would be on the QSED, for any patient with the specified DOB. By increasing and decreasing this date the user should be able to identify which dates of birth result in the ‘correct’ age and which dates of birth would result in an age which falls outside of the desired criteria.
This example can be amended to compare date of birth against any date of interest by changing the title in cell A1 and date in cell B1.
Last edited: 28 September 2026 2:22 pm