expression validation of date with dateAdd

Options

Hi,
I am trying to use Expression Validation for a Date and Time field in the Web-form. In my particular case the date should be at least 30 days from today. I checked Expression Validation article and saw that there is a dateAdd function but I cannot find which parameters it uses. I tried dateAdd(now(),30,days)<=DateTime(this), dateAdd(now(),30*24*60*60*1000)<=DateTime(this) and other options as validations but they don't seem to work.
Oh, and also I think the examples "day(this) >= (day(now())+3)" for "Date must be 3 or more days after today" and "(day(this) >= (day(now())) and (day(this) <= day(now())+2))" for "Date must be between today and 3 days from today" from the article are not accurate as changes in months are not considered.
Does anyone know how to make this kind of a date validation directly in a Web-form?
Thank you!

Best Answer

  • Tom_121527
    Tom_121527 Posts: 9
    Answer ✓
    Options

    Hi @Olga_343359, thanks for raising this question. I think the examples could be improved. When you have a moment, would you mind letting me know if this expression meets your needs DateTime(this) >= DateTime(now()).plus({ days: 30 })?

Answers

  • Olga_343359
    Options

    hi @Tom_121527 , worked like a charm :) Thanks!

  • Sumaiya_130508
    Options

    Hi,
    Kindly provide some solution for below points:

    • To get the number of days in current month (eg for sep :30) in variable.
    • To start a push bot on 2nd last day of the month.
  • Kalin_996882
    Kalin_996882 Posts: 74 admin
    Options

    Hi @Taj_137028 ,
    Could you post the points you've shared as a new question in Community? Once posted, we can address your question in the new thread. Please reach out if you have any questions. Thank you!