M
M
margaret_murka2021-09-07 09:51:55
PHP
margaret_murka, 2021-09-07 09:51:55

How to filter items by modification date (bitrix, getList)?

I'm trying to add filtering by date
, the getList method, the value of DATE_MODIFY_FROM
, I don't know what's wrong, it seems like you just need to write the date, but it doesn't work,
probably the date is not written correctly?
other filters work fine

$arFilter = array("IBLOCK_ID" => array($category), "ACTIVE" => "N", "DATE_MODIFY_FROM" => '2021-08-02 00:00:00');
  $res = CIBlockElement::GetList(array('id' => 'desc'), $arFilter, false, array("nPageSize" => 10), $arSelect);

it says "time is indicated in the site format", I tried "2020.08.02" "2020.08.02 00:00:00"
honestly, I have no idea what else to google, everything seems to be correct, but it does not work

// Still wondering if filter with DATE_MODIFY_TO nothing is displayed, but with DATE_MODIFY_FROM everything (with any dates)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
margaret_murka, 2021-09-08
@margaret_murka

If suddenly there is another person who has problems with registration, and stupid mistakes)

$arFilter = array(">DATE_CREATE" => date('01.05.2021'), ">TIMESTAMP_X" => date('01.08.2021'));

A
Alexander, 2021-09-07
@idruweb

https://dev.1c-bitrix.ru/api_help/iblock/classes/c...
TIMESTAMP_X - by change time (Date filter);
DATE_MODIFY_FROM - by modification time. Items changed after the time specified in the filter will be selected. Time is indicated in the format of the site. It is possible to use the negation operator "!DATE_MODIFY_FROM";
DATE_MODIFY_TO - by modification time. Items changed before the time specified in the filter will be selected. Time is indicated in the format of the site. It is possible to use the negation operator "!DATE_MODIFY_TO";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question