Re: [greenstone-users] display or e-mail of recently added item

From jens wille
DateFri, 04 Feb 2005 18:13:43 +0100
Subject Re: [greenstone-users] display or e-mail of recently added item
In-Reply-To (42038646-9030803-univie-ac-at)
hi birgit!

Birgit Kellner wrote:
> I have noticed that on importing documents and building a collection,
> Greenstone adds the date of import into the metadata of a document, in
> unix date format.
> One way to display recent additions would be a hierarchical classifier
> that makes use of this medatata field, but how would I print the "real"
> date, like 01-12-2004, and not the unix date, next to each displayed
> record?
maybe you could use something like this in your format statement:

"<script type=text/javascript>my_date([Title])</script>"

where [Title] = [lastmodified] when built with "AZCompactList
-metadata lastmodified".

my_date() is the following javascript function, e.g. defined in (macro , package document):

function my_date(epoch) {
z = new Date();
/* epoch = seconds since 00:00:00 UTC, January 1, 1970
but setTime expects milliseconds */
y = z.getFullYear();
m = z.getMonth()+1;
m = m.toString(10).length < 2 ? '0'+m : m;
d = z.getDate();
d = d.toString(10).length < 2 ? '0'+d : d;

(i just made a quick test - and it worked :-)