Go Back > PhpDig Forums > How-to Forum

Thread Tools
Old 03-22-2004, 10:20 PM   #1
Orange Mole
Join Date: Mar 2004
Posts: 48
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.

jerrywin5 is offline   Reply With Quote
Old 03-23-2004, 01:45 AM   #2
Head Mole
Charter's Avatar
Join Date: May 2003
Posts: 2,539
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.
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort results by date rather than relevance ? phil851 Mod Requests 0 06-17-2005 05:10 AM
No most searched terms, biggest results, most 0 results, last search queries, etc. jongag1 How-to Forum 6 04-22-2005 10:43 AM
Search by date wessam Mod Requests 3 07-18-2004 09:18 AM
database format pacotelic How-to Forum 1 05-09-2004 03:34 PM
Adding date (of spidering) to search results lighthouse How-to Forum 1 03-22-2004 09:50 PM

All times are GMT -8. The time now is 10:17 PM.

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