Compares two date times to determine whether they are within a specified range of each other.
Syntax
_CompareDatesWithRange(date1,date2,datePart,rangeMin,rangeMax)
Parameters
Parameters for _CompareDatesWithRange
Parameter |
Definition |
Data type |
---|---|---|
date1 |
First date to use. |
PFDateTime |
date2 |
Second date to use. |
PFDateTime |
datePart |
Date part used to calculate the interval between date1 and date2. |
Integer |
rangeMin |
Minimum number in the range to compare with the interval between date1 and date2. |
Integer |
rangeMax |
Maximum number in the range to compare with the interval between date1 and date2. |
Integer |
Returns
True or False (Boolean), indicating whether the first date time is within the specified range of the second date time.
Notes
Note: If the time period includes a February month with 29 days, then 366 days equal 1 year. Otherwise, 365 days equal 1 year.
For example, if a start date is in a month with 31 days, then 31 days from the start date is one month. If the date range goes from February until September, then each month's number of days is used for the calculation. For example, 28 (or 29, if February has 29 days) days from the start date in February is one month; 31 days from the date in March is another month; 30 days from the date in April is another month; and so on.
For increments that are fewer than 28, 29, 30, or 31 days, depending on the month, the range is 0 months.
Example
This example checks whether a reported adverse event lasts for more than six months. The rule is defined at the form level and checks the StartDate and EndDate items in that form. This rule creates a query when an adverse event lasts more than six months.
evaluate on Form Submission
value = _CompareDatesWithRange(this.StartDate.Value, this.EndDate.Value, DateTimeParts.Months, 0, 6)
when value is false
issue query on this.EndDate: Adverse Event lasted more than six months.
Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.