Subject: Search results without the time

Posted on: 16/10/07 05:47pm
By: Imaginate

This is the code that outputs the DATE & TIME with the search results: does anyone know how to remove the actual time from the date in its place put the year?

or at least just remove the time from the story?

// get rows
$A['title'] = str_replace ('$', '$', $A['title']);
$thetime = COM_getUserDateTimeFormat ($A['day']);
if (empty ($urlQuery)) {
$articleUrl = COM_buildUrl ($_CONF['site_url']
. '/article.php?story=' . $A['sid']);
} else {
$articleUrl = $_CONF['site_url'] . '/article.php?story='
. $A['sid'] . '&query=' . urlencode ($urlQuery);
$author = $this->_displayName ($A['username'], $A['fullname']);
if ($A['uid'] == 1) {
$profile = $author;
} else {
$profile = '<a href="' . $_CONF['site_url']
. '/users.php?mode=profile&amp;uid=' . $A['uid']
. '">' . $author . '</a>';
$row = array ('<a href="' . $articleUrl . '">'
. stripslashes ($A['title']) . '</a>',

Re: Search results without the time

Posted on: 16/10/07 07:52pm
By: machinari

if you're keen on modifying the core then to start you can modify (config.php):
PHP Formatted Code

$_CONF['dateonly']        = '%d-%b';
Change the previous to the following In order to reflect the year as well as just the day and month (which I think a date should do anyway) like so (config.php):
PHP Formatted Code
$_CONF['dateonly']        = '%d-%b-%Y';

Then change the code you quoted above to reflect the following (search.class.php):
PHP Formatted Code
                //$thetime = COM_getUserDateTimeFormat ($A['day']);
                $thetime[0] = strftime( $_CONF['dateonly'], $A['day'] );

You can always just define your own custom date format and create a new space for it in the config.php file like $_CONF['mypreferreddateformat'] and then use that in the above snippet.

Or you could add your preferred date format to the database and just select it as default in your site's settings. That would make it a site wide change, but you wouldn't have to modify the core.

I can go on if you like, but that should get you going.

Re: Search results without the time

Posted on: 16/10/07 08:31pm
By: Imaginate

that worked perfectly. Thanks so much.

this is the output

Geeklog - Forum