Text
slash
colon
comma
dash
space
custom text
Year
yyyy - four-digit year
yy - two-digit year
Month
MMMM - full month
MMM - abbr. month
MM - padded month
M - month
Day
dddd - full day of week
ddd - abbr. day of week
dd - padded day of month
d - day of month
Hour
h - hour (1-12)
hh - hour (01-12)
H - hour (0-23)
HH - hour (00-23)
tt - AM/PM
Min/Sec
m - minute (0-59)
mm - minute (00-59)
s - second (0-59)
ss - second (00-59)

See Microsoft's official documentation for more details about the CONVERT function.

Learn more about the ISO 8601 standard.

See Microsoft's official documentation for the DATEPART function.

See Microsoft's official documentation for more information about standard formatting strings.

Learn more about RFC-1123.

See Microsoft's official documentation for more custom formatting tokens.

Also, check out Microsoft's Format Utility, a Windows Forms application for testing format strings.

This utility is meant to help you parse and format dates when using Microsoft SQL Server.

Note that different versions of SQL Server may have different capabilities and behaviors. In particular, the FORMAT function is only available in SQL Server 2012 and newer.

Additionally, culture & localization settings on the database server and clients may influence the behavior of some functions. When in doubt, refer to the documentation:

This utility was written by hand using the following software: