SSRS Date format expressions

Information gleamed from http://www.sqlservercentral.com/Forums/Topic290724-150-3.aspx

The Format function is locale aware and can be used as follows [not the case senstivity]
Set Language=User!language in the Report properties and use the Format function with the following codes:

Standard Format Specifiers for Dates and Times:
The table below shows the standard date and time formatters.

d Short Date
D Long date
f long date & short time
F long date and long time
g short date and short time
G short date and long time
M or m month and day
Y or y year and month
t short time
T long time
s displays in ISO 8601 format using local time
u displays in ISO 8601 format using universal time
U date and time in unversal time
R or r displays in RFC 1123 format

Custom formatting sequences:
There are also specific character sequences that can be used to achieve custom formatting of dates and times.

Format Description

d day of month (1 or 2 digits as required)
dd day of month (always 2 digits, with a leading 0 if needed)
ddd day of week (3 letter abbreviation)
dddd day of week (full name)
M month number (1 or 2 digits as required)
MM month number (always 2 digits, with a leading 0 if needed)
MMM month name (3 letter abbreviation)
MMMM month name (full name)
y year ( last 1 or 2 digits, no leading 0)
yy year (last 2 digits)
yyyy year (4 digits)
H hour in 24-hour format (1 or 2 digits as required)
HH hour in 24-hour format (always 2 digits, with a leading 0 if needed)
h hour in 12-hour format (1 or 2 digits as required)
hh hour in 12 hour format
m minutes (1 or 2 digits as required)
mm minutes (always 2 digits, with a leading 0 if needed)
s seconds (1 or 2 digits as required)
ss seconds
t first character in the am/pm designator
tt am/pm designator
z time zone offset, hour only (1 or 2 digits as required)
zz time zone offset, hour only (always 2 digits, with a leading 0 if needed)
zzz time zone offset, hour and minute
/ default date separator
: default time separator
\ escape characters

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s