A
A
Alexander Ivanov2016-07-05 10:21:08
1C-Bitrix
Alexander Ivanov, 2016-07-05 10:21:08

How to filter value by date property?

trying to filter from the beginning of the month to the end

$curdate = "1.06.2016";//как пример
$lastdate = "31.06.2016";
$GLOBALS['ar2Filter'] = Array(
  "ACTIVE" => "Y", 
  //">=DATA_SOBYTIYA" => $curdate,
  "!PROPERTY" => array( 
  //">=DATA_SOBYTIYA" => $curdate,
    'DATA_SOBYTIYA' => array(
      //">=VALUE" => $curdate,'
      VALUE' => false,
      //"<=VALUE" => $lastdate)
  //"<=DATA_SOBYTIYA" => $lastdate
  ),
  //"<=DATA_SOBYTIYA" => $lastdate
);

commented out the options that I tried

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-07-05
@cimonlebedev

You need to convert the date to the format stored in the database: YYYY-MM-DD.
Bitrix has some kind of monstrous crutch for this in the BD class (well, where else to format the date?), But I prefer to use the standard library of the language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question