Card image cap
SQL Server FORMAT with Culture

Let's start with an example:

SELECT FORMAT (getdate(), 'dd-MM-yy') as dateGO

The format will be as follows:

  • dd - day number from 01-31
  • MM - month number from 01-12
  • yy - two digit year number

If this was run for March 21, 2018 the output would be: 21-03-18.

Let's try another one:


SELECT FORMAT (getdate(), 'hh:mm:ss') as timeGO

The format will be as follows:

  • hh - hour of day from 01-12
  • mm - minutes of hour from 00-59
  • ss - seconds of minute from 00-59

The output will be: 02:48:42.

My Cart