Learning Hub..!

Prbhakaran J – Blog


SQL Server CONVERT() Function

Convert() function used to convert one data type to another datatype, be used to display date/time data in various formats


-- CONVERT Syntax:  
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )  


data_type | Refer the which datatype what to be convert.

( length ) | Refer the length of the new data type.

expression | Refer the source datatype which one you want convert.

style | Refer the specifies how the CONVERT function will translate expression


SELECT CONVERT(Varchar(20),GETDATE(),20) AS [YYYY-MM-DD hh:mm:ss]   

Thank You

1 Comment

  1. BrianSwand

    You’ve among the best internet websites.

Leave a Reply

Prabhakaran Jayaraman