Column Formatting - Dates, Booleans, Numbers

Modified on Thu, May 11, 2023 at 3:06 PM

Column Formatting

Dates

The formatting codes you can use for dates are (These are CASE SENSITIVE)

Letter

Date or Time Component

Presentation

Examples

G

Era designator

Text

AD

y

Year

Year

1996; 96

M

Month in year

Month

July; Jul; 07

M - 1 M gives Month in year, no leading zero.

MM - 2 Ms gives Month in year with leading zero.

MMM - 3 Ms gives abbreviation for month (e.g. Jul, Aug, Mar)

MMMM - 4 Ms gives full month name (January, February,...)

w

Week in year

Number

27

W

Week in month

Number

2

D

Day in year

Number

189

d

Day in month

Number

10

d - Day in month with no leading zero

dd - two digit day in month with a leading zero

F

Day of week in month

Number

2

E

Day in week

Text

Tuesday; Tue

a

Am/pm marker

Text

PM

H

Hour in day (0-23)

Number

0

k

Hour in day (1-24)

Number

24

K

Hour in am/pm (0-11)

Number

0

h

Hour in am/pm (1-12)

Number

12

m

Minute in hour

Number

30

s

Second in minute

Number

55

S

Millisecond

Number

978

z

Time zone

General time zone

Pacific Standard Time; PST; GMT-08:00

Z

Time zone

RFC 822 time zone

-0800

Date Examples

Format

Example Output

yyyy-MM-dd

2008-12-03

MM/dd/yyyy

12/03/2008

M/d/yyyy

12/3/2008

MM/dd/yyyy hh:mmaa

12/03/2008 12:45pm

MMMM,dd,yyyy

December,01,2008

MMM ddJuly 24 (birthday)

Numbers (Integer, Long, Float and Double)

Some example number formats

Format

Example Number

Example Output

#

13

13

#.00

3.5

3.50

00.00

3.5

03.50

If you put a > at the end of the format; zeros will be suppressed.   For example:

Format

Example Number

Example Output

#>

1

1

#>

0


#.00

3.5

3.50

#.00>

0.0


Boolean

Boolean values are handled in different ways depending on whether they are in an Expression or being used as a Filter or printed in a Column.  In an Expression (that is, between the '${' and '}' brackets), you must use the Boolean true and false constants.  In ReportWriter Filters (on the Filters screen), you must use Y for true and N for false.  

The ReportWriter normally prints Boolean values as Y or N.   The Format column (on the Columns screen) can be used to replace Y and N with other Strings.  Specify the words to replace the Y or N separated by a ,. Some examples are:

Format

Example Value

Example Output

Description

true,false

N

false

Print 'true' or 'false'

true,false

Y

true

Print 'true' or 'false'

Yes,No

Y

Yes

Print 'Yes' or 'No'

Yes,No

N

No

Print 'Yes' or 'No'

X,

Y

X

Print 'X' or blank

X,

N


Print 'X' or blank
,NoY
Print a blank or 'No'
,NoNNoPrint a blank or 'No'
Hi,ByeNByeAny two Strings can be used.

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article