5 Posts
narciso
1 year ago
1
Topic

Hello,

I would like to search between two dates using JCckContentArticle search method. Using:

$content = new JCckContentArticle;
$data = array( 'catid'=>2, 'state'=>1 );
$content->search( $content_type, $data );

I tried:

$content->with( 'created', '>=', '2018-09-01' );
$content->with( 'created', '<=', '2018-09-15' ); // Shows only <= 2018-09-15. The second 'with' replaces the first. There is no "And"

Then I tried:

$content->with( 'created', 'between', '2018-09-01', '2018-09-15'); // Error 1064 -> in the SQL syntax
$content->with( 'created', 'between', '2018-09-01', 'and', '2018-09-15'); // Error 1064 -> in the SQL syntax

I was trying 'between' operator I read in the Changelog, but I have no idea how:
---------------- 3.21.5 Upgrade Release [03-Dec-2021] --------------
+ "between" operator support added on JCckContent find/search methods.

Anybody knows how I can write this 'between' operator.
Thanks,
Narciso.

Using Seblod 4.0.1 and Joomla! 4.2.6

Get a VIP membership
5 Posts
narciso
1 year ago
0
Level 1

As in /libraries/cck/_/content.php :

$content->with( 'created', 'between', '2018-09-01|2018-09-15');

as well as

$content->with( 'created', 'between', '2018-09-01,2018-09-15');

Narciso.

Get a VIP membership