Показать сообщение отдельно
Старый 07.12.2016, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: A dynamic query range for month to date (SysQueryRangeUtil)
Источник: http://www.agermark.com/2016/12/a-dy...h-to-date.html
==============

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)).

Источник: http://www.agermark.com/2016/12/a-dy...h-to-date.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.