Skip to main content.
home | support | download

Back to List Archive

Re: Date formatting

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Wed Aug 28 2002 - 16:09:44 GMT
At 08:35 AM 08/28/02 -0700, David VanHook wrote:
>
>I've got a custom PropertyNameDate called date, which I'm substituting for
>the swishlastmodified property.  It's searching and displaying properly, but
>I'd like to modify the way it is displayed.  I'm wondering how I should go
>about re-formatting that date so that it displays more like
>
>Aug 27, 2002
>
>or something like that.  Do I need to do that in the search.tt template?  Or
>in the CGI script somehow?

Hi David,

You might check the archives as I think I posted a patch for this at one
point.

But there's a few things you can do.

One, you could parse the data in swishlastmodified in either the
module/TemplateToolkit.pm or by creating a Template::Plugin to do that.

Or in swish.cgi you could modify: (untested)

$self->swish_command( -x => join( '\t', map { "<$_>" } @properties ) . '\n' );

and add an additional map { $_ eq swishlastmodified ? qq[$_ fmt="%ld"] : $_ }

which would return a unix timestamp and then you can format with Template
Toolkit in your template.

Does that help?





-- 
Bill Moseley
mailto:moseley@hank.org
Received on Wed Aug 28 16:13:11 2002