date or datetime to date
Added by Anonymous almost 13 years ago
Legacy ID: #10817327 Legacy Poster: https://www.google.com/accounts ()
Hello all, Is there a function that can take either a date or datetime and in both cases extract the date? So for 1956-01-03T00:00:00.0000000+02:00 it would give 1956-01-03 and same output for 1956-01-03. I am needing this because although I am expecting a date, I might receive a datetime from some external systems because of their own constraints. Regards,
Replies (2)
RE: date or datetime to date
-
Added by Anonymous almost 13 years ago
Legacy ID: #10817592 Legacy Poster: Michael Kay (mhkay)
I think you need to do something like this if ($x castable as xs:dateTime) then xs:date(xs:dateTime($x)) else xs:date($x) This question isn't Saxon-specific; a better place for general XSLT an XPath questions is the xsl-list at mulberrytech.com, or StackOverflow.
RE: date or datetime to date
-
Added by Anonymous almost 13 years ago
Legacy ID: #10817696 Legacy Poster: David Lee (daldei)
I have learned to use a horrible hack, assuming $x is a string ... xs:dateTime( fn:replace( $x , "T.*:,"") )
Please register to reply