How to format Dates and Numbers using Report info macro?
Purpose
How to format Dates and Numbers using Report info macro?
Answer
Date and time
Letter | Date | Examples |
---|---|---|
| Era designator |
|
| Year |
|
| Month in year |
|
| Week in year |
|
| Week in month |
|
| Day in year |
|
| Day in month |
|
| Day of week in month |
|
| Day in week |
|
| Am/pm marker |
|
| Hour in day (0-23) |
|
| Hour in day (1-24) |
|
| Hour in am/pm (0-11) |
|
| Hour in am/pm (1-12) |
|
| Minute in hour |
|
| Second in minute |
|
| Millisecond |
|
| Time zone |
|
| Time zone |
|
Examples:
Date and Time Pattern | Result |
---|---|
| 2020/Dec/25 AD at 12:12:00 EST |
| Fri, 25/Dec/2020 |
| 12:12 PM |
| 12 o'clock PM, Eastern Standard Time |
| 2020.December.25 |
To find out more about date formatting, please refer to SimpleDateFormat documentation.
Numbers
Format | Description |
---|---|
0 | A digit always will be displayed (if the number doesn't have enough digits, 0 will be displayed AKA zero padding) |
# | A digit, (if the number doesn't have enough digits nothing will be displayed) |
. | (period) Marks decimal separator |
, | (comma) Marks thousand separator |
% | Multiplies by 100 and shows number as percentage |
X | Marks a character to be used in number prefix or suffix |
' | (single quote) Marks a quote around special characters in prefix or suffix of formatted number. |
Examples:
Pattern | Input | Formatted output |
---|---|---|
|
| 12.3 |
|
| 12.30 |
|
| 123,456,789.01 |
###.0# |
| 123456.79 |
|
| 0.123 |
|
| % 2,550.00 |
|
| % 25.50 |
To find out more about number formatting, please refer to the DecimalFormat documentation.