This content has been marked as final. Show 4 replies
Try converting your dates into #date objects. You can then subtract one
from the other. You'll need to parse your current string representation,
perhaps using "-" as the itemDelimiter.
the itemDelimiter = "-"
d1 = date(integer(d1.item), integer(d1.item), integer(d1.item))
d2 = date(integer(d2.item), integer(d2.item), integer(d2.item))
nDiff = d2 - d1
Thanks for the reply. Basically this is what i have already done, but this thing basically doesn't compare, i need to compare two different dates, like they are equal or greater or less then.
Like Sean says, convert your 'date' strings into date objects and then you can subtract one from the other or do simple comparisons. Eg
dateObject1 = date("20060815")
dateObject2 = date("20061021")
put dateObject1 = dateObject2
put dateObject1 < dateObject2
put dateObject1 > dateObject2
If all else fails, you can do a simple formula to convert each date into a
dateValue1 = (year1 * 366) + (month1 * 31) + days1
dateValue2 = (year2 * 366) + (month2 * 31) + days2
Then just compare dateValue1 and dateValue2. This formula leaves gaps at
the end of some months, and all non-leap years, but for the sake of a simple
greater/less than comparison, these don't matter. (If you needed to be more
precise, you'd have to refine the formula somewhat, but the simple version
works fine for just >/< calcs.)