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 :

A dynamic query range for month to date (SysQueryRangeUtil)

PA-22040759-0 Profile Picture PA-22040759-0 6,194
Here is the code for creating a month-to-date filter:

public static str monthToDateRange(int relativeDays = 0)
{
utcdatetime currentDateTime;

currentDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone());

SysQueryRangeUtil::dateRange(
dateStartMth(DateTimeUtil::date(currentDateTime)),
DateTimeUtil::date(DateTimeUtil::addDays(currentDateTime, relativeDays)));
}

The code must be added to the SysQueryRangeUtil class.

Use it like (monthToDate(n)) where n is the number of days from today. So month-to-date-yesterday would for example be (monthToDate(-1)).

Comments

*This post is locked for comments