Skip to main content.
home | support | download

Back to List Archive

Re: using another meta tag as a way to sort by date

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Tue Nov 25 2003 - 22:00:47 GMT
On Tue, Nov 25, 2003 at 01:26:41PM -0800, NOW Website Coordinator wrote:
> At 01:17 PM 11/25/2003 -0800, you wrote:
> >On Tue, Nov 25, 2003 at 12:23:58PM -0800, NOW Website Coordinator wrote:
> >> I'd like to use a meta tag as a way to sort by date, but instead of the
> >> actual file date, I'd like to use a tag which reflected the last change 
> >to
> >> the content, not just the formatting of the page.
> 
> Thanks for the quick response.  Is there any way to get it to use a date 
> that a web editor, not a programmer, could write?  Ie, 01/31/2003 ?  The 
> people editing this aren't going to be at the command line.

That's what -S prog is good for.  If your website is using HTML for it's
source then use HTML::Parser (or even a simple regular expression).

Use Date::Manip and then your web editors can be creative in their date format:

$ perl -MDate::Manip -le 'print scalar localtime Date::Manip::UnixDate("now","%s")'
Tue Nov 25 13:56:00 2003

$ perl -MDate::Manip -le 'print scalar localtime Date::Manip::UnixDate("yesterday","%s")'
Mon Nov 24 13:56:07 2003

$ perl -MDate::Manip -le 'print scalar localtime Date::Manip::UnixDate("last friday","%s")'
Fri Nov 21 00:00:00 2003

$ perl -MDate::Manip -le 'print scalar localtime Date::Manip::UnixDate("9am tomorrow","%s")'
Wed Nov 26 09:00:00 2003

Actually, I think ParseDate does even more:

$ perl -MDate::Manip -le 'print Date::Manip::ParseDate("2nd thursday in January")'
2003010900:00:00

$ perl -MDate::Manip -le 'print Date::Manip::ParseDate("2nd thursday in March")'
2003031300:00:00




> 
> 
> >You want a property.
> >
> >PropertyNamesDate mydate
> >
> >moseley@bumby:~$ date +%s
> >1069794964
> >moseley@bumby:~$ perl -le 'print time'
> >1069794966
> >
> >In html
> >
> ><meta name="mydate" content="1069794964">
> >
> >or
> >
> ><mydate>
> >  1069794964
> ></mydate>
> >
> >
> >
> >--
> >Bill Moseley
> >moseley@hank.org

-- 
Bill Moseley
moseley@hank.org
Received on Tue Nov 25 22:00:51 2003