Skip to content

Instantly share code, notes, and snippets.

@mikaelweave
Last active November 9, 2017 16:50
Show Gist options
  • Save mikaelweave/74eb10e16273078fa22d to your computer and use it in GitHub Desktop.
Save mikaelweave/74eb10e16273078fa22d to your computer and use it in GitHub Desktop.
Convert SQL DATETIME to superior human DATETIME
SELECT
FORMAT(GETDATE(), 'g'),
CONVERT(VARCHAR(32), CAST(GETDATE() AS DATE), 101) AS d,
REPLACE(REPLACE(RIGHT(CAST(GETDATE() AS DATETIME), 7), 'AM', ' AM'), 'PM', ' PM') AS t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment