How To Get The Number Representing Day Of Week In Bpel Xpath (Doc ID 1448997.1)

Last updated on NOVEMBER 03, 2016

Applies to:

Oracle SOA Suite - Version 11.1.1.5.0 and later
Information in this document applies to any platform.

Goal

The xpath function format-dateTime() is the appropriate way to format date information inside a BPEL process. However, it only returns the day of week as a string literal, either full or abbreviated, and the string literal is exposed in the language corresponding to the local environment of the server. See the xpath documentation for details, but note that the current implementation in SOA 11g only allows the first two parameters.

In order to calculate the number value for the weekday or return the weekday in other languages, some Java coding is required, the java.util.Calendar class is the appropriate way to accomplish this. The following simple Java program would print out a number value and literal in English:

public class MyCalendar {
    public static void main(String[] args) {
        java.util.Calendar cal = java.util.Calendar.getInstance();
        int i_dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
        String s_dayOfWeek = cal.getDisplayName(java.util.Calendar.DAY_OF_WEEK,java.util.Calendar.LONG, java.util.Locale.ENGLISH);
        System.out.println("Day Of Week [int] = " + i_dayOfWeek);
        System.out.println("Day Of Week [String] = " + s_dayOfWeek);
    }
}


For other languages, check the java.util.Locale class.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms