From DateTime to Date in XQuery

When you create a database adapter using JDeveloper in the SOA Suite, the Date fields in the database will be modelled as DateTime fields in the xsd. Often you will only want Date fields.

A simple way to convert the DateTime fields to Date fields using XQuery is like this:

[code]<ns3:Birthdate>{ data(xs:date(substring-before($pollStudentCollection/ns4:Student[1]/ns4:birthdate/text(),’T’))) }</ns3:Birthdate>[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.