Our community of experts have been thoroughly vetted for their expertise and industry experience.
I have been involved in projects for Renault (GST Project), Orange (COME Project), SFR (P6 Project), Samsung, Poclain Hydraulics, EDF...
Published:
Browse All Articles > How to add N days to the current date of day, then format the date according to "dd/mm/yyyy" in BPEL.
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs.
First of all, let's see how to add 1 day to the current date, in a XSL expression:
There are 2 functions used here. The most important part in this article is the special format 'P1D' which means "one day". So the current date is obtained with the "xp20:current-date()" and the number of days to add is defined with the '1' between the 'P' and the 'D' in the format 'P1D'.
So to add N days, the format must be in the following form : 'P' + number of days + 'D'. For example, to add 40 days to the current date and to get back the new calculated date, the following command must be used :
The BPEL concatenation function is used and enables to concatenate the 3 parts : the 'P', the number of days and the 'D'.
The String function is used to convert the number of days in character format.
All that can be done with the BPEL Expression Builder when working on a BPEL process. A useful trick is to use CTRL+SPACE to ease the creation of an expression.
Last evolution : Format the result date according to "dd/mm/aaaa" (european countries) :
Here, the format-dateTime function is used, with the specific format '[D01]/[M01]/[YYYY]' that means days with 2 digits, months with 2 digits and year with 4 digits. :)
Comments (0)