Skip to main content
Known Participant
Jul 1, 2024 5:36 PM UTC
Question

Add validation difference between two date and time should not more than 24 hrs

Hi All,

Need your help in the following issue:

Please how can I get the difference  between two dates should not more than 24 hrs? 

For example 1 :

Start Date = 7/1/2024 12:00 AM EST

End Date = 7/1/2024 11:59 PM PST

if user enter the above dates and time than Don’t allow to select since the difference is > 24 hours

Thank you in advance for your help!

    2 replies

    venkatrea696188
    Inspiring
    Jul 1, 2024 6:20 PM UTC

    Just subtract the dates use  hour()  functions to check whether difference between the dates is greater than your requirement 

    Inspiring
    Jul 1, 2024 6:30 PM UTC

    this might help with some logic to get you started ...

    a!localVariables(
    
    local!maxTime: addhours(ri!startTime,24),
    
    a!match(
    value: local!maxTime,
    whenTrue: local!maxTime < ri!endTime,
    then: "end time exceeds 24 hours",
    default: {}
    )
    
    
    )

    Note this uses this component ...

     [mention:d7ae9642523840f797e96e47dbfa6bae:f7d226abd59f475c9d224a79e3f0ec07]