Greater than Date and Less than date with Equal to Date ranges
Views (10255)
Hello Readers,
Recently I have one requirement where I have to filter the record on the basis of Date range, I have found the standard class “SysQueryRangeUtil” and the method greater than and less than methods is available, personally I found these two methods quite confusing to use as it have 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);
}
{
return '> ' + SysQuery::value(_date);
}
str greaterThanEqualDate(transDate _date)
{
return '> ' + SysQuery::value(_date-1);
}
{
return '> ' + SysQuery::value(_date-1);
}
str lessThanDate(transDate _date)
{
return '< ' + SysQuery::value(_date);
}
{
return '< ' + SysQuery::value(_date);
}
str lessThanEqualDate(transDate _date)
{
return '< ' + SysQuery::value(_date+1);
}
{
return '< ' + SysQuery::value(_date+1);
}
Please comment your queries and suggestions,
Thanks,
Cheers,
Viral Suthar
This was originally posted here.
*This post is locked for comments