Share via


Formatting Numeric and Date Values in a Report

You can specify a format for numeric and date values by updating the Format property of its text box with a formatting string. For example, you can set a text box for a numeric field to display the number as currency. Reporting Services uses Microsoft .NET Framework formatting strings or you can create a custom formatting string for the Format property.

Note

To apply formatting to a text box, the text box must contain an expression, for example, =Fields!LineTotal.Value or =1000. If the text box is not an expression, that is, if the text in the text box does not begin with the equal (=) sign, then the text is interpreted as a string and formatting does not apply.

Formatting Numbers

The following table lists common .NET Framework number formatting strings.

Format string Name

C or c

Currency

D or d

Decimal

E or e

Scientific

F or f

Fixed-point

G or g

General

N or n

Number

P or p

Percentage

R or r

Round-trip

X or x

Hexadecimal

You can modify many of the format strings to include a precision specifier that defines the number of digits to the right of the decimal point. For example, a formatting string of D0 formats the number so that it has no digits after the decimal point. You can also use custom formatting strings, for example, #,###.

Formatting Dates

The following table lists common .NET Framework date formatting strings.

Format string Name

d

Short date

D

Long date

t

Short time

T

Long time

f

Full date/time (short time)

F

Full date/time (long time)

g

General date/time (short time)

G

General date/time (long time)

M or m

Month day

R or r

RFC1123 pattern

Y or y

Year month

You can also a use custom formatting strings; for example, dd/MM/yy. For more information about .NET Framework formatting strings, see "Formatting Types" at msdn.microsoft.com..

See Also

Concepts

Formatting Report Items
Designing the Report Layout

Help and Information

Getting SQL Server 2005 Assistance