Solved

How to validate that end date is greater than start date

  • 10 August 2015
  • 4 replies
  • 65 views

I have two date fields: Start date and End Date. I am trying to find a way to validate that the end date is greater than or equal to the start date. If I used datediff, it gives me the number of days difference between the two dates, but only as a positive number (e.g. 1/8/2015 & 4/8/2015 = 3; 4/8/2015 & 1/8/2015 = 3, so using this to catch where the second example would normally be -3!!

I have looked everywhere to try and find a simple solution....HELP!!!

icon

Best answer by patrick_hosch 12 August 2015, 10:33

View original

4 replies

Hi Michael Campbell‚Äč, not sure why it doesn't show -3 (or any other negative value). i have just tried this using the DateDiffDays and DateDiffSeconds functions and both work as expected. I get negative values in case the end date is before the start date. can you share a screenshot?

DateDiffIssue.PNG

The 8 should be displayed as -8?? My Formula field is dateDiffDays(EndDate,StartDate)

this is caused by having the first date in the function as the end date. turn the dates in the function around: dateDiffDays(StartDate,EndDate)

DateDiffDays return positive values only, to validate the date use greaterThan function instead.

Reply