OSB 12c custom xquery functions
Here are the some of OSB custom xquery function that came across: 1. mmddyyyy to date conversion: declare function ns1:mmddyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else xs:date(concat(substring($dateString,7,4),'-', substring($dateString,1,2),'-', substring($dateString,4,2))) } ; 2. day of week: declare function ns1:day-of-week ( $date as xs:date? ) as xs:integer? { if (empty($date)) then () else xs:integer(($date - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ; 3. day of week name: declare function ns1:day-of-week-name ( $date as xs:date? ) as xs:string? { ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') [ns1:day-of-week($date) + 1] } ;