Validating Date

Hi All!

Sorry, Just a beginner question.

How do you check & validate the date if out of range from 01/2020 to 12/2022
Example scenario:

Date = 12/2023 then an error message will be triggered here

Question type is date

Thanks!

Hi,

In the Validation Conditions section, click on the “Add condition” button.
Set the condition based on the date range using the following syntax:

self >= DateTime.Parse(“2020-01-01”) && self <= DateTime.Parse(“2022-12-31”)

1 Like

It works! Thank you for this

See here for an important warning (3-rd party resource): https://zetcode.com/csharp/datetime-parse/

Correspondingly, instead of:

use:

self.Year.InList(2020,2021,2022)

Hi sergiy

Thanks for your reply. But when I try your code. It has syntax error per below:

Validation condition has a syntax error.

Correction:

self.Value.Year.InList(2020,2021,2022)
1 Like

It’s now working, Thanks sergiy!