The convert () function is a general function that converts a date to a new data type.
The convert () function can display date/time data in different formats.
Syntax:
Convert (data_type (length), date_to_be_converted, style)
Date_type (length) specifies the target data type (with optional length ). Data_to_be_converted contains the value to be converted. Style specifies the output format of the date/time.
Values of the available styles:
Styleid style format
100 or 0 mon dd yyyy hh: miam (or pm)
101/DD/yy
102 yy. Mm. dd
103 dd/mm/yy
104 dd. mm. yy
105 DD-mm-yy
106 dd mon YY
107 mon DD, YY
108 hh: mm: SS
109 or 9 Mon dd yyyy hh: MI: SS: mmmam (or pm)
110-dd-yy
111 YY/MM/dd
112 yymmdd
113 or 13 dd mon yyyy hh: mm: SS: Mmm (24 h)
114 hh: MI: SS: Mmm (24 h)
120 yyyy-mm-dd hh: MI: SS (24 h)
121 yyyy-mm-dd hh: MI: Ss. Mmm (24 h)
126 yyyy-mm-ddthh: mm: Ss. Mmm
130 dd mon yyyy hh: MI: SS: mmmam
131 dd/mm/yy hh: MI: SS: mmmam
------------------------------
Convert (varchar (19), getdate ())
Convert (varchar (10), getdate (), 110)
Convert (varchar (11), getdate (), 106)
Convert (varchar (24), getdate (), 113)