Novell is now a part of Micro Focus

Timestamps, XPATH and Java

Novell Cool Solutions: Tip
By Perin Blanchard

Digg This - Slashdot This

Posted: 1 Mar 2006


A reader asked:

"I am trying to get a human-readable string of the date and time that I can add to other text and then insert into the description attr in eDir. I am getting an error that says:

Message: Code(-9131) Error in ... 
eDirectory/Publisher/Matching Rule#XmlData:47 : Error evaluating XPATH
expression ... XPathEvaluationException: function call to
'jformat:parse' resulted in an error: 'java.text.ParseException:
Unparseable date: "1126129825"'.


You want something along the lines of this:

<do-set-local-variable name="current-format">

The timestamp value is "roughly" equivalent to what you would get from "java.lang.System.currentTimeMillis()" or "java.util.Date.getTime()". So to format and use it, you would need to strip the stuff including and after the '#', multiply it by 1000, create a new Date instance, etc.

You could use something like the following:

* 1000))

Then you would need to put that code in the appropriate location.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates