This topic is locked
[SOLVED]

 date picker search feature 5.2 and unix timestamp

5/20/2010 4:36:18 PM
PHPRunner General questions
C
chaintm author

I need to know the location and or code needed to convert the date picker used in the search feature to convert readable dates to unix timestamps. As seen below, I convert inputed dates to strtotime timestamps so when files are saved in timestamp the search by date only searches with readable format not timestamp which I save in on the database.
Do I use Search Page: Before process and convert the search in standard human readable to strtotime? I attempted this conversion here but didn't seem to work, or I might need to know the values that phprunner uses in the search fields to convert a date search request?
$values["event_time_start"] = strtotime($values["event_time_start"]);

$values["event_time_end"] = strtotime($values["event_time_end"]);
please note I do use a conversion to make it readable threw the actual value on the editor...
if ($value)

$value = date("m/d/Y",$value);
//=========================================

if ($value == date("m/d/Y"))
{

$color="white";

$value="<font color='$color'>$value</font>";

}

else

{

$color="black";

$value="<font color='$color'>$value</font>";

}

A
ann 5/21/2010

Hi,
use SQL mode on the Edit SQL query tab to create an alias which will convert timestamp to date. Here is a sample for MySQL:

SELECT

...

FROM_UNIXTIME(event_time_start) as ReadableDate,

...

FROM TableName



Then you can use that field for search.

C
chaintm author 5/21/2010

Worked great! had to use format conversions
FROM_UNIXTIME(event_time_start,'%m/%d/%Y') AS ReadableDate,
and still can't use the calander picker, but am able to have the user imput the data in the search box as 05/20/2010 etc
I will see if down the line i can get the calander to work and if so I will post those results. Thnx for the help!