Skip to content

Instantly share code, notes, and snippets.

@devlights
Created March 9, 2015 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devlights/993f484c705c6897d8c2 to your computer and use it in GitHub Desktop.
Save devlights/993f484c705c6897d8c2 to your computer and use it in GitHub Desktop.
[SQLServer] 日付の文字列変換 (CONVERT, 111, 108, 120)
DECLARE @d DATETIME = GETDATE();
-- yyyy/MM/dd HH:mm:ss
SELECT CONVERT(NVARCHAR, @d, 111) + ' ' + CONVERT(NVARCHAR, @d, 108)
-- yyyy-MM-dd HH:mm:ss
SELECT CONVERT(NVARCHAR, @d, 120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment