Tags

, ,

 

Hi,

We often get request to display the Date/Time in various different formats in SSRS reports. That is made possible through Convert() Function.

Convert() Function is basically used to convert an expression from one data-type to another and can also be used to display Date/Time data in different formats.

Syntax: Convert(data_type(length),expression,style_value)

Example: Convert(Varchar(10),CreatedOn,103)

The different style values are as follows:

Value (yy) Value (yyyy) Input/Output
100 mon dd yyyy hh:miAM (or PM)
1 101 mm/dd/yy
2 102 yy.mm.dd
3 103 dd/mm/yy
4 104 dd.mm.yy
5 105 dd-mm-yy
6 106 dd mon yy
7 107 Mon dd, yy
108 hh:mm:ss
                           109 mon dd yyyy hh:mi:ss:mmm AM/PM
10 110 mm-dd-yy
11 111 yy/mm/dd
12 112 yymmdd
113 dd mon yyyy hh:mi:ss:mmm (24h)
114 hh:mi:ss:mmm (24h)
120 yyyy-mm-dd hh:mi:ss (24h)
121 yyyy-mm-dd hh:mi:ss.mmm (24h)
126 yyyy-mm-ddThh:mi:ss.mmm (no spaces)
130 dd mon yyyy hh:mi:ss:mmmAM
131 dd/mm/yy hh:mi:ss:mmmAM

The same with examples has been very briefly explained here.

Thanks !!! 

🙂