B
B
barder2020-09-01 09:28:27
1C-Bitrix
barder, 2020-09-01 09:28:27

How to select infoblock elements by date greater than a certain one?

Good day.

There is an infoblock, there are elements, I needed to parse the elements for the current day

$arSelect = Array("ID", "NAME", "DATE_ACTIVE_FROM", "DATE_CREATE");
$arFilter = Array("IBLOCK_ID"=>16, "PROPERTY_ID_VK" => "", "ACTIVE" => "Y", ">=DATE_ACTIVE_FROM" => date("Y-m-d")." 00:00:00");
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>100), $arSelect);
while($ob = $res->GetNextElement())
  {
    $arFields = $ob->GetFields();
  ?><pre><?print_r($arFields)?></pre><?

but for some reason it displays all elements with an empty property "PROPERTY_ID_VK"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2020-09-01
@barder

// чтобы получить дату в формате сайта (в битриксе)
$date = date('Y-m-d');
$timestamp = MakeTimeStamp($date, 'YYYY-MM-DD');
$convertDateTime = ConvertTimeStamp($timestamp);

$arFilter = Array("IBLOCK_ID"=>16, "PROPERTY_ID_VK" => false, "ACTIVE" => "Y", ">=DATE_ACTIVE_FROM" => $convertDateTime);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question