PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   Format modified date for search results (http://www.phpdig.net/forum/showthread.php?t=706)

jerrywin5 03-22-2004 10:20 PM

Format modified date for search results
 
Just getting going with PHPDig. It is great. I have a few questions to ask and I'll start with this one.

How can I format the date that is displayed in the search results via <phpdig:update_date/> so that it displays a format such as Mar 22, 2004?

In includes/config.php I see:
PHP Code:

define('PHPDIG_DATE_FORMAT','\1-\2-\3');   // Date format for last update 

but this modifies the order of the display rather than the format. In libs/search_function.php I also see
PHP Code:

'update_date' => ereg_replace('^([0-9]{4})([0-9]{2})([0-9]{2}).*',PHPDIG_DATE_FORMAT,$content['last_modified']), 

but haven’t delved into regular expressions yet so am lost. Any help would be appreciated.

Thanks,
Jerry

Charter 03-23-2004 01:45 AM

Hi. Perhaps try the following.

In search_function.php replace:
PHP Code:

'update_date' => ereg_replace('^([0-9]{4})([0-9]{2})([0-9]{2}).*',PHPDIG_DATE_FORMAT,$content['last_modified']), 

with the following:
PHP Code:

'update_date' => date("l dS of F Y h:i:s A",strtotime(substr($content['last_modified'],0,8)." ".substr($content['last_modified'],8,2).":".substr($content['last_modified'],10,2).":".substr($content['last_modified'],12,2))), 

Then look at the date function and change "l dS of F Y h:i:s A" into whatever format you want.

Remember to remove any "word" wrapping in the above code.


All times are GMT -8. The time now is 05:01 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.