Here, we will play with the xp20:format-dateTime() function and generate different date and time formats.
About xp20:format-dateTime():
This function takes two arguments
- dateTime : like 2021-08-13T07:35.29.849+00:00
- Format: the format which we want.
Meaning of all the format codes:
Lets play with the different date and time formats:
Example1: change the dateTime to dd-MM-yyyy format.
xp20:format-dateTime(startTime,"[D01]-[M01]-[Y001]")
Output: 13-08-2021
Example2: change tthe dateTime to dd-MM-yyyy HH:mm:ss
xp20:format-dateTime(startTime,"[D01]-[M01]-[Y001] [H01]:[m01]:[s01]
Output: 13-08-2021 08:55:22
Example 3 : change the dateTime to yyyy-MM-dd h:mm AM/PM
xp20:format-dateTime(startTime,"[Y001]-[M01]-[D01] [h1]:[m01] [P]
Output: 2021-08-13 8:55 am
Example4: change the datTime to HH:mm Timezone
xp20:format-dateTime(startTime,"[H01]:[m01] [z]
Output: 08:55 GMT+00:00
Example5: change the dateTime to ordinal value of day-monthname-day of the week
xp20:format-dateTime(startTime,"[Dwo]-[MNn]-[FNn]
Output:thirteenth-August-Friday
Used Formats in OIC:
Received output from monitoring:
No comments:
Post a Comment