• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/analytics/agent.php
  • Класс: BitrixSaleInternalsAnalyticsAgent
  • Вызов: Agent::getNextExecutionAgentDate
static function getNextExecutionAgentDate(): MainTypeDateTime
{
	$date = new DateTime();
	$currentMonth = $date->format('n');

	$date->modify('+1 day');
	$modifiedMonth = $date->format('n');

	if ($modifiedMonth > $currentMonth)
	{
		$nextDate =
			$date
				->modify('first day of '.$date->format('F'))
				->format(MainTypeDateTime::getFormat())
		;
	}
	else
	{
		$nextDate = $date->format(MainTypeDateTime::getFormat());
	}

	return new MainTypeDateTime($nextDate);
}