Sunday, August 2, 2015

Format date and time on SSRS report

We could format the date and time in SSRS in simple way.


1. Right on the field in which column you want to format

2. Type  “Format(Fields!DOCMODIFIED.Value,"dd/MM/yyyy")” in the expression box and Click ok


Below is a list of various format codes available in SSRS and some examples

Format Code
Description
Example
d
Single Digit Date Format
9
dd
Double Digit Date Format
09
ddd or dddd
Full Day Name
Wednesday
M
Single Digit Month Format
2
MM
Double Digit Month Format
02
MMM
Three Character Month Name
Feb
MMMM
Full Month Name
February
yy
Double Digit Year Format
11
yyyy
Four Digit Year Format
2011
H
Single Digit “24 Hour” Hour Format
6
HH
Double Digit “24 Hour” Hour Format
06
hh
Double Digit “12 Hour” Hour Format
06
m
Single Digit Minute Format
9
mm
Double Digit Minute Format
09
s
Single Digit Second Format
4
ss
Double Digit Second Format
04
tt
ante meridian (AM)/post meridian (PM) part of Time
PM
zzz
Time Zone Offset w.r.t. GMT
+05:30

=Format(Fields!DOCMODIFIED.Value,"dd/MM/yyyy") -> 03/08/2015

=Format(Fields!DOCMODIFIED.Value,"dd/MMM/yyyy") ->03/Aug/2015

=Format(Fields!DOCMODIFIED.Value,"dd/MMMM/yyyy") -> 03/August/2015

=Format(Fields!DOCMODIFIED.Value,"dd-MMM-yyyy") -> 03-Aug-2015

=Format(Fields!DOCMODIFIED.Value,"dd-MMM-yyyy HH:mm") -> 03-Aug-2015 13:28

=Format(Fields!DOCMODIFIED.Value,"dd-MMM-yyyy HH:mm tt") -> 03-Aug-2015 13:28 PM

I hope this article will be very helpful to all. Thanks for reading this article.

“Keep reading and share the knowledge”  
“Grow more trees to save the Earth”


No comments:

Post a Comment