How to Format Dates in SQL Server

Last updated July 25, 2026 · By the SaturnSQL team

CONVERT(varchar, date, style) formats with a numeric style code: 23 gives yyyy-MM-dd, 120 gives yyyy-MM-dd hh:mm:ss, 101 gives MM/dd/yyyy. FORMAT() takes .NET format strings but is much slower, so avoid it on large result sets.

SELECT
  CONVERT(varchar(10), GETDATE(), 23)  AS iso_date,     -- 2026-07-25
  CONVERT(varchar(19), GETDATE(), 120) AS iso_datetime, -- 2026-07-25 14:30:00
  CONVERT(varchar(10), GETDATE(), 101) AS us_date;      -- 07/25/2026

FORMAT() for custom patterns

FORMAT runs through .NET and is routinely 10-50x slower than CONVERT. Fine for a report header, a bad idea for a million-row export; format in the application layer instead.

SELECT FORMAT(GETDATE(), 'dd MMM yyyy') AS pretty_date; -- 25 Jul 2026

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related SQL Server guides

© 2026 Panda Capital Oy Ab. All rights reserved.