[xquery-talk] the least stupid way to just print the current date in xquery

jidanni at jidanni.org jidanni at jidanni.org
Thu Dec 1 23:51:38 PST 2011


Gentlemen, its my "virgin" post to the list. Allow me to test the waters
by asking what's the least stupid way to just print the current date in
xquery? (Without the ugly timezone baggage.)
$ basex -q 'tokenize(string(current-date()),"\+")[1]'
2011-12-02
gives me exactly what I want, but it is rather 'expensive'.
Other solutions involving fn:substring might break in 10000-2011=7989 years.
Yes, something like the opposite of
http://www.w3.org/TR/xpath-functions/#func-timezone-from-date
or something(s) that would NOT just give me
2011-12-2
Hmm, fn:substring-before might break if I move to the other side of
Greenwich, as will my tokenize without [+-] erg... Enough. How do you
guys just print the current date?


More information about the talk mailing list