I have two Date/Time fields that need to compare, ON my validation Check-Out time must be greater than check-in time.

How to compare them in the validation rule?

CheckIn_Time (Date/Time)
CheckOut_Time (Date/Time)

I have tried the below rule, it compares the only date not time

DATEVALUE(CheckIn_Time__c) > DATEVALUE(CheckOut_Time__c)

  • 3
    What have you tried that has not worked?
    – Moonpie
    Aug 25 at 16:42

Simple arithmetic operators work when comparing a Date/Time to a Date/Time.

You must do conversions or other operations to extract the parts you need if you want to compare Date to Date/Time.

This Validation Rule: CheckOut_Time__c <= CheckIn_Time__c

Resulted in this:

enter image description here

and this:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.