Date Time Format in Oracle Integration Cloud

Post ID : PI2302181

In this article, OraclePapa will bless you via demonstrating on how to change date time format to a different format in Oracle Integration cloud. We will use Date(2023-02-21T05:09:05.049+00:00) as input for this purpose.


Even though this article is enough in itself and self explanatory but for a visual and practical version, OraclePapa suggests you to go through our detailed video on this topic-DateTime Format in Oracle Integration Cloud.

There comes a lot of situation while development when we need to pass datetime as an input parameter in a particular format or we need to display date to user in some fixed asked format. The only issue comes when the datetime value which we have is in some other format but desired format is some other.

Oracle Integration Cloud Service provides an Out of the box function xp20:format-dateTime, which returns the formatted string of dateTime using the format provided.

Let’s have a deep dive in the function – xp20:format-dateTime

Definition: This function returns the formatted string of dateTime using the format provided. For example, [Y0001]-[M01]-[D01].

Input : This function have two input parameters.

  1. DateTime in available format
  2. Desired DateTime Format as string

Output : Formatted string of dateTime.

Let’s go through few examples to understand the use of function – xp20:format-dateTime. We will use Default dateTime Format in OIC (2023-02-21T05:09:05.049+00:00) as input 1 for this purpose.

Example 1: Desired Format dd-MM-yyyy, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[D01]-[M01]-[Y0001]‘)

Example 2: Desired Format dd-MM-yyyy HH:mm:ss, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[D01]-[M01]-[Y0001] [H01]:[m01]:[s01]‘)

Example 3: Desired Format MM/dd/yyyy HH:mm:ss, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]‘)

Example 4: Desired Format yyyy-MM-dd h:mm AM/PM, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[Y0001]-[M01]-[D01] [h1]:[m01] [P]’)

Example 6: Desired Format HH:mm TimeZone, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[H01]:[m01] [z]’)

Example 5: To get the ordinal value of the day, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[Dwo]’)

Example 7: To get the name of the Month in the capital, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[MNn]’)

Example 8: To get the day of the week, Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,‘[FNn]’)

Example 9: To get the first 3 letters of month (dd-MMM-yyyy), Syntax will be

xp20:format-dateTime(2023-02-21T05:09:05.049+00:00,[D01][MNn,3-3]-[YYYY]’)

References & Suggested Read
  1. Send dateTime from OIC to Oracle Fusion
  2. Watch video version of this blog

Leave a Comment

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