Calculation: If date older than

Viewing 3 reply threads
  • Author
    Posts
  • April 17, 2026 at 1:16 PM #53984

    Martha Montgomery
    Participant

    How do I do a date calculation in an if statement? Example, I want this calculation…but, I have the syntax wrong:

    If(Date < “04/01/2026, 0, 1)

    If the date is older than the date I enter, then I want a result of zero else give me a 1

    The field is a date field that I have formatted “MM/DD/YYYY”).

    April 17, 2026 at 7:18 PM #53985

    Brendan
    Keymaster

    Hi Martha,

    You’ll want to use the DATE() function to convert your date string into a proper date object.

    IF(Date < DATE("04/01/2026", "MM/dd/yyyy")

    The case of the pattern string on the right is important also. MM is for the month digits. dd is for the day, and yyyy is for the 4 digit year.

    April 18, 2026 at 3:03 PM #53989

    Martha Montgomery
    Participant

    Thanks for the information. I can not get it to work…the DATE function seems to be calculating Dec 31, 1969 regardless of what date I enter or what date is in the Date field. I will email you my Form to see if you see what I am doing wrong.

    April 18, 2026 at 4:44 PM #53993

    Brendan
    Keymaster

    My sincere apologies. I sent you down the wrong path. The right function to use is DATEVALUE() as that converts a textual representation of a date with a real date object. The DATE() function goes the other way around, converting a real date object into a textual representation of the date according to the pattern string provided.

Viewing 3 reply threads

You must be logged in to reply to this topic.