Tuesday, 29 July 2014

Different Date Formats For BPEL Process

This function returns the formatted string of dateTime using the format provided.

xp20:format-dateTime(dateTime as string, format as string)

  •   dateTime – The dateTime to be formatted
  •    format – The format for the output
Format String:-

Format Date Time: Year

Example
Expression
2012
[Y0001]
2012
[Y]
12
[Y01]
Two Thousand and Twelve
[YWw]

Format Date Time: Month

 Example
Expression
08
[M01]
8
[M]
VIII
[MI]
August
[MNn]
AUGUST
[MN]
Aug
[MNn,*-3]
AUG
[MN,*-3]

                                      
Format Date Time: Day

Example
Expression
05
[D01]
5
[D]
5
[D1]
31st
[D1o]
Tuesday
[FNn]


Format Date Time: Hour

Example
Expression
3
[h]
9
[H]
08
[H01]


Format Date Time: Minute
Example
Expression
03
[m01]
3
[m]

Format Date Time: Second
Example
Expression
09
[s01]
9
[s]

Format Date Time: Millisecond
Example
Expression
257
[f001]

Format Date Time: AM/PM
Example
Expression
PM
[PN]
Am
[Pn]


Format Date Time: GMT
Example
Expression
GMT+02:00
[z]



Example:-

xp20:format-dateTime(xp20:current-dateTime(),"[D01]/[M01]/[Y0001] [H01]:[m01]:[s01]")

add-dayTimeDuration-from-dateTime:

This function returns a new date time value adding dateTime to the given duration.
If the duration value is negative, then the resulting value precedes dateTime.

xp20:add-dayTimeDuration-from-dateTime(dateTime as string, duration as string)
  • dateTime as string – The dateTime to which the function adds the duration, in string format.
  • duration as string – The duration to add to the dateTime, or subtract if the duration is negative, in string format.
Duration:-

    P1D - a day
    P7D - a week
    P1M - a month
    P1Y1DT1H1S - One year, one day, one hour and one second
    PT5M - five minutes
Example:-

xp20:add-dayTimeDuration-to-dateTime(xp20:current-date(), 'P1D')

subtract-dayTimeDuration-from-dateTime:
This function returns a new dateTime value after subtracting duration from dateTime.
If the duration value is negative, then the resultant dateTime value follows input-dateTime value.

xp20:subtract-dayTimeDuration-from-dateTime(dateTime as string, duration as string)
  • dateTime as string – The dateTime from which the function subtracts the duration, in string format.
  • duration as string – The duration to subtract to the dateTime, or add if the duration is negative, in string format.

Duration:-

    P1D - a day
    P7D - a week
    P1M - a month
    P1Y1DT1H1S - One year, one day, one hour and one second
    PT5M - five minutes

Example:-
xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'P1D')

No comments:

Post a Comment