RTF Date Formatting: well, any report you create, one crucial field type will be of Date Type and depending on the geography of the user, you will be tasked to format the date in specific format. Now the field can be of 2 type: one is coming from the database and other will be the system date (sysdate) to show right up in the report header. This post is to give the syntax and how you can show the date in various formats. For the demonstration purpose, my XML has a tag named ACCT_DATE. Value of the field is 2020-12-13T18:22:59.682+00:00.
One point to remember is that date value should be in Java date format for the syntax to work. My preference is YYYY-MM-DDTHH:Mi:SS. If your date is not in Java supported format, code might not work properly and there are chances that your formatting effort will not bear any fruit i.e. date will get printed as it is available in input XML field.
So below is the code snippet where you can see various options available and in the next image, you can see the corresponding output. For first 6 formats, ACCT_DATE tag is used while last 3 are the examples for system date ( sysdate) manipulation.
RTF Date Formatting Code Snippet
1 | <?format-date: ACCT_DATE;’DD/MM/YYYY’?> |
2 | <?format-date: ACCT_DATE;’MM/DD/YYYY’?> |
3 | <?format-date: ACCT_DATE;’YYYY/MM/DD’?> |
4 | <?format-date: ACCT_DATE;’SHORT’?> |
5 | <?format-date: ACCT_DATE;’LONG_TIME_TZ’?> |
6 | <?format-date: ACCT_DATE; ‘MEDIUM’?> |
7 | <?format-date:xdoxslt:sysdate_as_xsdformat();’SHORT’?> |
8 | <?format-date:xdoxslt:sysdate_as_xsdformat();’MEDIUM’?> |
9 | <?format-date:xdoxslt:sysdate_as_xsdformat();’LONG’?> |
Output
And here is how the output looks like for above code syntax
As you can see that function sysdate_as_xsdformat() is used to get the system date ( sysdate). But watch out for the timezone of the user. Reason being, with Oracle Fusion Cloud in place, chances of users being in different timezone is considerably high. And that is why timezone is important while printing the date.
Related Posts
RTF Number Formatting With Examples
RTF- Looping Finite Number Of Times
How To Develop an RTF Template
Feedback:
Hope the article helped you. If it did, please rate the post. In case it didn’t, do leave a comment to let us know what did we miss.
Reference:
support.oracle.com
Check out the Amazon Deals of the day based on your interests..