Gossamer Forum
Home : Products : Links 2.0 : Customization :

Remove year from date

Quote Reply
Remove year from date
How do I remove the year from my link.html insert <%Date%> so that links only read 14-Feb etc?
Quote Reply
Re: Remove year from date In reply to
Brian,

There is a FAQ in the Resource Center that talks about how to change the date formats. The URL is http://www.gossamer-threads.com/...es/Detailed/325.html

There are two date routines located in links.cfg. They are called date_to_unix and unit_to_date. You should just have to modify unit to date.

Original code:

Code:
return "$day-$month[$mon]-$year";

to

Code:
return "$day-$month[$mon]";

I have not tested this change, but it looks pretty simple Wink

Frank

------------------
Webmasters Resources
http://www.webmasters-resources.com/
Quote Reply
Re: Remove year from date In reply to
The solution I'm gonna provide will only modify the way the date is displayed locally, not globally... though Frank's way looks fine, too...

In sub site_html_link in site_html_templates, add right before return &load_template...
Code:
my $shortdate = $rec{'Date'};
$shortdate =~ s/(\w+-\w+)-\w+/$1/;
and then in return &load_template before %rec, add...
Code:
shortDate => $shortdate,
In your link.html template, use <%shortDate%> instead of <%Date%>...

One other piece of advice... if you are at all serious about learning Perl to customize your code/site, pick up a good book on regular expressions. I've said it before, but I'd estimate that over 80% of the mods I do are mainly regex related...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited February 25, 2000).]