{"id":660,"date":"2024-01-04T20:06:00","date_gmt":"2024-01-04T20:06:00","guid":{"rendered":"https:\/\/eipsoftware.com\/musings\/?p=660"},"modified":"2024-04-14T20:09:36","modified_gmt":"2024-04-14T20:09:36","slug":"date-format-list","status":"publish","type":"post","link":"https:\/\/eipsoftware.com\/musings\/date-format-list\/","title":{"rendered":"Date Format List"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Stop searching the web for date formats, query the database<\/p>\n<cite>Michael  M.<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Simple query to show you all the date time formats in the database.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >\nDECLARE @counter INT = 0\nDECLARE @date DATETIME = '2006-12-30 00:38:54.840'\n\nCREATE TABLE #dateFormats (dateFormatOption int, dateOutput nvarchar(40))\n\nWHILE (@counter &lt;= 150 )\nBEGIN\n   BEGIN TRY\n      INSERT INTO #dateFormats\n      SELECT CONVERT(nvarchar, @counter), CONVERT(nvarchar,@date, @counter) \n      SET @counter = @counter + 1\n   END TRY\n   BEGIN CATCH;\n      SET @counter = @counter + 1\n      IF @counter &gt;= 150\n      BEGIN\n         BREAK\n      END\n   END CATCH\nEND\n\nSELECT * FROM #dateFormats;<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Stop searching the web for date formats, query the database Michael M. Simple query to show you all the date time formats in the database.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[43,4,6],"tags":[14,15],"series":[],"class_list":["post-660","post","type-post","status-publish","format-standard","hentry","category-sql-t-sql","category-code","category-sql","tag-sql","tag-t-sql"],"_links":{"self":[{"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/posts\/660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/comments?post=660"}],"version-history":[{"count":2,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/posts\/660\/revisions"}],"predecessor-version":[{"id":662,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/posts\/660\/revisions\/662"}],"wp:attachment":[{"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/media?parent=660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/categories?post=660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/tags?post=660"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/eipsoftware.com\/musings\/wp-json\/wp\/v2\/series?post=660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}