FORMAT() function syntax with an example in SQL Server

    FORMAT() function syntax with an example in SQL Server

·        This function returns a value formatted with the specified format.

·        The function FORMAT () accepts 3 parameters. The first parameter is the VALUE parameter where the date value or numeric value is passed. The second parameter is the.NET Framework format string. The format parameter is case sensitive.  The third parameter is the culture. This can be any culture supported by the .NET Framework.

Example:
  DECLARE @d DATETIME = ‘01/06/2011’;
  SELECT FORMAT ( @d, 'dd/MM/yyyy', 'en-US' )

Result:
   06/01/2011


If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar