Unify and manage your data

Show Page Sections

DVF date functions

Learn about the date functions used in a data validation.

Use date functions in Data Validation Functions (DVF) to validate attributes that have a date format of YYYY-MM-DD.

Table 1. Date Functions
FunctionDescriptionSample
rangeThe validation function checks that the attribute value is between the two static dates. If the validation is met, then the appropriate validation message is displayed. range(attributes.DoJ.value,'1980-01-01','2019-12-31')
equalsThe validation function checks that the attribute value matches the given static date or another date attribute value exactly. If the validation is met, then the appropriate validation message is displayed.

This function supports the NOT conditional operator.

equals(attributes.DoJ.value,'2019-02-16') equals(attributes.DoB.value,attributes.DoD.value)
gtThe validation function checks that the attribute value is greater than the given static date or another date attribute value. If the validation is met, then the appropriate validation message is displayed.

This function supports the NOT conditional operator.

gt(attributes.DoJ.value,'2019-01-01') gt(attributes.DoB.value,attribute.DoD.value)
gteThe validation function checks that the attribute value is greater than or equal to the given static date or another date attribute value. If the validation is met then the appropriate validation message is displayed.

This function supports the NOT conditional operator.

gte(attributes.DoJ.value,'2019-01-01') gte(attributes.DoB.value,attribute.DoD.value)
ltThe validation function checks that the attribute value is lesser than the given static date or another date attribute value. If the validation is met then the appropriate validation message is displayed.

This function supports the NOT conditional operator.

lt(attributes.DoJ.value,'2019-01-01') lt(attributes.DOB.value, attributes.DOD.value)
lteThe validation function checks that the attribute value is lesser than or equal to the given static date or another date attribute value. If the validation is met, then the appropriate validation message is displayed.

This function supports the NOT conditional operator.

lte(attributes.DoJ.value,'2019-01-01') lte(attributes.DOB.value, attributes.DOD.value)
existsThe validation function checks that the given attribute value exists. If the validation is met, then the appropriate validation message is displayed. exists(attributes.DoJ.value)
missingThe validation function checks that the given attribute value is missing. If the validation is met, then the appropriate validation message is displayed. missing(attributes.DoJ.value)
relative date comparisionsThe validation function checks that the attribute value is within a relative date, in days, to the current date. For example, check if the DOB value is less than 1 day from the current date when validated. For more information, see section Use DVF expressions to compare relative dates

During validation, the current date is compared against relative dates in the Coordinated Universal Time (UTC) timezone. See the section below for more details.

Note: For DVFs created with the Validate event field set to Create & Update profile or Update profile we recommend you only use the gte function.

For DVFs created with the Validate event field set to Create profile, we recommend you only use the ltfunction.

lt(attributes.DOB, '-P1D')

Use DVF expressions to compare relative dates

DVF expressions allow for dynamic comparisons of dates relative to the current date. Let's explore how to use DVF expressions with relative date comparisons using the following examples::

  • The Manufacturing date should be less than 2 years from the current date
  • The Supply date must be three months after the current date
  • The Sales date is equal to the current date
  • The Promotion date is 10 days from the current date

The following table illustrates how these conditions are expressed using DVF expressions:

ComparatorExample DVF expressionDescription
lt (less than)lt(attributes.ManufacturingDate.value, -P2Y)The Manufacturing date is less than 2 years before the current date. -P2Y represents a period of 2 years in the past using the ISO-8601 format.
lte (less than or equal to)lte(attributes.ManufacturingDate.value, -P2Y)The Manufacturing date is less than or equals to 2 years before the current date. -P2Y represents a period of 2 years in the past, using the ISO-8601 format.
equalsequals(attributes.PromotionDate.value, P10D)The Promotion date is exactly 10 days from the current date. P10D represents a period of 10 days from today in the ISO-8601 format.
equalsequals(attributes.SaleDate.value, P0D)The Sale date is equal to the current date. The P0D here denotes the current date in the ISO-8601 format.
gt (greater than)gt(attributes.SupplyDate.value, P3M)The Supply date is more than three months from the current date. P3M represents a period of 3 months in the future in the ISO-8601 format.
gte (greater than equals)gte(attributes.SupplyDate.value, P3M)The Supply date is at least three months from today.
Additional examples of how ISO-8601 durations indicate time before or after the current date
ExpressionMeaning
P32D32 days (in the future) from today
P15M15 months (in the future) from today
P5Y5 years (in the future) from today
-P3Y3 years ago
-P10M10 months ago
-P28D28 days ago

Relative dates comparison to UTC timezone

The date and timestamp fields are compared against relative dates in the Coordinated Universal Time (UTC) timezone.

When entering a date, there may be an anomaly when it compares the user's date (who is in a different timezone) to the UTC timezone. Here's an example.

Timezone A is 8 hours ahead the UTC timezone. A user in timezone A enters the current date as the 30th September at 4am. However, as per UTC, the current date is 29th of September at 8pm. During validation, the system infers the current date as 29th (as per the UTC timezone) and throws an error.

Timestamps, however, do not have such anomalies since the Timestamp field type is stored and compared in UTC only. System dates for entities, such as Start Date and End Date, are stored as timestamps and hence, will not face such anomalies.

Was this content helpful?