Greater than Date and Less than date with Equal to Date ranges
Hello Readers,
Recently I have one requirement where I have to filter the records on the basis of Date range, I have found the standard class “SysQueryRangeUtil” and the method greater than and less than is available, personally I found these two methods quite confusing to use as it has parameter in days. Also there is no option for Equal to date. So I have created below four methods, you can use it for Date range scenarios which very easy to understand.
str greaterThanDate(transDate _date) { return '> ' + SysQuery::value(_date); } str greaterThanEqualDate(transDate _date) { return '> ' + SysQuery::value(_date-1); } str lessThanDate(transDate _date) { return '< ' + SysQuery::value(_date); } str lessThanEqualDate(transDate _date) { return '< ' + SysQuery::value(_date+1); }
Please comment your queries and suggestions,
Thanks,
Cheers,
Viral Suthar
Comments
Post a Comment