[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

the least stupid way to just print the current date in xquery

Geert Josten geert.josten at dayon.nl
Fri Dec 2 00:02:24 PST 2011


  the least stupid way to just print the current date in xquery
I think the most elegant way would be something like:

let $today := current-date()
let $year := year-from-date($today)
let $month := month-from-date($today)
let $day := day-from-date($today)
return
	concat($year, '-', $month, '-', $day)

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] Namens
http://x-query.com/mailman/listinfo/talk
Verzonden: vrijdag 2 december 2011 8:52
Aan: http://x-query.com/mailman/listinfo/talk
Onderwerp:  the least stupid way to just print the current
date in xquery

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?
_______________________________________________
http://x-query.com/mailman/listinfo/talk
http://x-query.com/mailman/listinfo/talk


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.