cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing Dates

0 Kudos

Hi,

I want to compare dates in SAP IS, if 1 date is greater than the other, but when I do the test it doesn't compare the full date format (e.g DD.MM.YYYY) but it'll maybe compare DD only and ignores MM and YYYY or MM and igonres DD and YYYY.

Example 1: I want to return TRUE if DATE1 is less than DATE2 where DATE1 = 31.10.2011 and DATE2 = 31.10.2012. In this case it should consider the year as well but it only looks at the DD and MM and returns TRUE for equality of DD and MM.

Example 2: I want to return TRUE if DATE1 is less than DATE2 where DATE1 = 31.10.2012 and DATE2 = 01.11.2013. In this case it returns TRUE as it sees DD of DATE1 being greater than DD of DATE2.

These examples shoud return FALSE looking at the entire date format and not only bits and pieces...

Please help

Accepted Solutions (1)

Accepted Solutions (1)

NielsWeigel
Product and Topic Expert
Product and Topic Expert
0 Kudos

You need to check the variable formats you are using. Do you have defined the parameters of the validation rule to be of format DATE? Or is it defiend as a VARCHAR? Then you need to use one of the embedded conversion functions within Information Steward Validation Rule Editor.

The User Manual includes details on the pre-defined functions of the Validation Editor.

If you have defined the parameters as VARCHAR, then if compares with "greater than" the ASCII code of the first character...

Niels

0 Kudos

Hi Niels,

Thank you very much for the answer. My data type was DATE as well.

I actually got it to work after sending my enquiry.

I was testing using this date format DD.MM.YYYY and realized that IS using outputs YYYY.MM.DD and when I tested using this format, everything works eventually.

Thanks again.

Roli

Answers (0)