On 14/10/15 13:40, Wetz Peter wrote:
Dear all,
at [1] I read about the afn:now() function. I want to use it, to add a column
to my query results, which shows the current time.
Is it possible to adjust the output format of afn:now()? Currently, the format
looks like this: 2015-10-14T11:50:34.583+02:00
Could this be changed to, for instance, the following format:
2015-10-14T11:50+02:00
You can manipulate the value or manipulate the lexical form.
There are functions to access the date/time components of the VALUE.
Arthimetic on xsd:dateTimes is supported using xsd:durations (and it's
derived types).
Or you can hack the lexical form. It so happens that '.' only occurs in
the fractional part of to seconds and not before.
# Assumes there is a factional part. There is for afn:now.
STRBEFORE(STR(afn:now()),'.')
or use REPLACE.
# General
REPLACE(STR(afn:now()), '(\\.\\d*)?(Z|\\+\\d\\d:\\d\\d)?$')
for suitable re-escaping of \
Don't forget the timezone can be Z.
Maybe cast it back to an xsd:dateTime.
Andy
In other words: It should only display minutes and omit seconds and
milliseconds. Is this possible, or should this be done by the application which
processes the query results?
Thank you very much.
[1] https://jena.apache.org/documentation/query/library-function.html