1
cauchy
how to search for a month in the field user_regdate?
  • 2004/4/7 21:25

  • cauchy

  • Just popping in

  • Posts: 4

  • Since: 2004/4/7 1


I have tried to hack the file modules\system\admin\finduser\main.php in order to perform search on the field user_regdate of the table users. I am interested to select from this table only users who were registered in a particular month of the year.
mese_regdate is my form variable.
Why something like that doesn't work?
if ( !empty($HTTP_POST_VARS['mese_regdate']) &&is_numeric($HTTP_POST_VARS['mese_regdate']) ) {    $meseintval($HTTP_POST_VARS['mese_regdate']);    $criteria->add(new Criteria("MONTH(user_regdate)"$mese));}


please, someone can help me?
thanks in advance.

2
Mithrandir
Re: how to search for a month in the field user_regdate?

XOOPS doesn't use MySQL's date format, but instead a UNIX timestamp.

To do, what you want, you could do this:
$criteria->add(new Criteria("user_regdate"mktime(0,0,0,$mese,1,2004), ">=");
$criteria->add(new Criteria("user_regdate"mktime(0,0,0,$mese+112004), "<");

This will return the users, who registered on or after 12:00 AM on the 1st of your month and before 12:00 AM on the 1st of the following month.

However, if you want to search for users, who registered in may of ANY year, your approach will have to be different.

3
cauchy
Re: how to search for a month in the field user_regdate?
  • 2004/4/8 2:49

  • cauchy

  • Just popping in

  • Posts: 4

  • Since: 2004/4/7 1


Thanks for your quick reply Mithrandir.
However I want to search for users who registered in a month of ANY year.
After a very hard job I have found this solution:
$criteria->add(new Criteria("FROM_UNIXTIME(user_regdate, '%c')"$mese));

this work just fine.

Login

Who's Online

367 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 367


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits