web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Greater than Date and Less than date with Equal to Date ranges

Viral Suthar Profile Picture Viral Suthar 279
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);
}
 
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


This was originally posted here.

Comments

*This post is locked for comments