[TYPO3] 'wfqbe' how to search date?

Mauro Lorenzutti mauro.lorenzutti at webformat.com
Mon Sep 24 14:39:00 CEST 2007


Hi,

 > Hi,
 >
 > I am currently trying to integrate wfqbe in my custom made extension 
'graveyard'. Problem is that dates are stored in UNIX TIMESTAMP format 
while search string is a normal date e.g. dd-mm-yyyy. Through 
documentation I know that a hook is used for that purpose.
 >
 > "ProcessSubstituteSearchParametersClass: this can be used to 
manipulate search parameters from a search form before executing the 
results query. For example, this is useful to convert a date parameter 
from a “dd-mm-yyyy” format to a timestamp before executing a query."
 >
 > But unfortunatly I was unable to do it.
 >
 >

[...]

 > By the ways issue_date is a field containing date in unix timestamp 
format. Please help me!
 >
 > Thanks in advance
 >
 > Junaid Mansoor Sootwala


You can avoid using hooks by using proper DBMS functions. For example, I 
created a search form with 3 fields (day,month,year) and I inserted this 
string in the where clause of my query record:

UNIX_TIMESTAMP('###WFQBE_YEAR###-###WFQBE_MONTH###-###WFQBE_DAY### 
00:00:00')

This will convert the human date in a timestamp value and can be used to 
search inside timestamp fields. Pay attention to the UNIX_TIMESTAMP 
function: this works with mysql, I don't know if it works with every DBMS.

Regards,

-- 
Mauro Lorenzutti


e-mail:  mauro.lorenzutti at webformat.com

---------------------------------------------------------
WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN
     Tel +39-0427-926.389  --  Fax +39-0427-927.653
       info at webformat.com  --  http://www.webformat.com
---------------------------------------------------------




More information about the TYPO3-english mailing list