Formatting in T-SQL - SQL 2012
SELECT
FORMAT(GETDATE(), 'yyyy-MM-dd') AS [ISO_Date],
FORMAT(GETDATE(), 'yyyy-MM-dd hh:mm:ss') AS [ISO_Date_time],
FORMAT(GETDATE(), 'MMMM dd, yyyy') AS [EN_DateFormat],
FORMAT(GETDATE(), 'MMMM dd, yyyy', 'fr-FR') AS [French_Format],
FORMAT(22.7, 'C', 'en-US') AS [US_Currency],
FORMAT(22.7, 'C', 'en-GB') AS [UK_Currency],
FORMAT(99 * 2.226, '000.000') AS [Decimal],
FORMAT(12345678, '0,0') AS [Thousand Separator]
;
SELECT
FORMAT(GETDATE(), 'yyyy-MM-dd') AS [ISO_Date],
FORMAT(GETDATE(), 'yyyy-MM-dd hh:mm:ss') AS [ISO_Date_time],
FORMAT(GETDATE(), 'MMMM dd, yyyy') AS [EN_DateFormat],
FORMAT(GETDATE(), 'MMMM dd, yyyy', 'fr-FR') AS [French_Format],
FORMAT(22.7, 'C', 'en-US') AS [US_Currency],
FORMAT(22.7, 'C', 'en-GB') AS [UK_Currency],
FORMAT(99 * 2.226, '000.000') AS [Decimal],
FORMAT(12345678, '0,0') AS [Thousand Separator]
;
No comments:
Post a Comment