Answer the question
In order to leave comments, you need to log in
How to display items by specific activity date?
There is an infoblock with several elements with a specific date of activity. It is required to display infoblocks with the date of activity, say, only 07/20/2019. Using the filter as a whole solves the problem, but if you set the date 07/19/2019, then active infoblocks will be displayed on the 19th and 20th. $filter = array("=ACTIVE_FROM" => "20.07.2019");
Answer the question
In order to leave comments, you need to log in
It would not be fate to see what sql query is generated and think a little?
Active_from is the start of the activity. It is logical that if you do not limit on the other hand, then everything after the specified date will be displayed.
In short, you take the 19th number, this is >= active_from. You add a day to the previous date, you get the 20th number, this is <active_to. That's it, these are your two filter values.
Ps since the strange Bitrix requires a date in a strange format, which is associated with some site settings, I advise you to pass values \u200b\u200bto the filter using Bitrix\Main\Type\DateTime, it will format everything itself
$filter = array("=ACTIVE_FROM" => "07/19/2019", "=ACTIVE_TO" => "07/19/2019");
You can also try
$filter = array("=ACTIVE" => "07/19/2019")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question