[{"data":1,"prerenderedAt":102},["ShallowReactive",2],{"post:format-date-strings":3},{"id":4,"title":5,"body":6,"date":89,"description":90,"draft":91,"extension":92,"meta":93,"navigation":94,"path":95,"seo":96,"stem":97,"tags":98,"__hash__":101},"posts\u002Fposts\u002Fformat-date-strings.md","TIL: How To Format Date Strings in SQL Server",{"type":7,"value":8,"toc":86},"minimark",[9,22,29,62,73,82],[10,11,12,13,17,18,21],"p",{},"Where ",[14,15,16],"code",{},"chr(10)"," is the myDateField column type to expect and ",[14,19,20],{},"103"," is the date format to use. The 100-plus date format codes will display a 4-digit year, whereas the 0-100 codes will display a 2-digit year. (Not recommended, if you ask me!)",[10,23,24,25,28],{},"So, to generate a standard ",[14,26,27],{},"mm\u002Fdd\u002Fyyyy"," date format:",[30,31,36],"pre",{"className":32,"code":33,"language":34,"meta":35,"style":35},"language-sql shiki shiki-themes github-light github-dark","CONVERT( chr(10), myDateField, 103)\n","sql","",[14,37,38],{"__ignoreMap":35},[39,40,43,47,51,54,57,59],"span",{"class":41,"line":42},"line",1,[39,44,46],{"class":45},"sj4cs","CONVERT",[39,48,50],{"class":49},"sVt8B","( chr(",[39,52,53],{"class":45},"10",[39,55,56],{"class":49},"), myDateField, ",[39,58,20],{"class":45},[39,60,61],{"class":49},")\n",[10,63,64,65,72],{},"See the ",[66,67,71],"a",{"href":68,"rel":69},"https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fsql\u002Ft-sql\u002Ffunctions\u002Fcast-and-convert-transact-sql?view=sql-server-2017",[70],"nofollow","SQL Server CAST and CONVERT docs"," for a full reference of the various date formats you can use.",[10,74,75,76,81],{},"For more info, you can ",[66,77,80],{"href":78,"rel":79},"http:\u002F\u002Fwww.sql-server-helper.com\u002Ftips\u002Fdate-formats.aspx",[70],"read this post from sql-server-helper.com which gives more detail and more concrete examples",".",[83,84,85],"style",{},"html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":35,"searchDepth":87,"depth":87,"links":88},2,[],"2018-12-26T08:30:00-05:00","Where chr(10) is the myDateField column type to expect and 103 is the date format to use. The 100-plus date format codes will display a 4-digit year, whereas the 0-100 codes will display a 2-digit year. (Not recommended, if you ask me!)",false,"md",{},true,"\u002Fposts\u002Fformat-date-strings",{"title":5,"description":90},"posts\u002Fformat-date-strings",[99,100],"sql-server","til","otGfBmh0NeJ6XSNYl5eh9lc3xLxtbMQoRC_ZV0Wz9K4",1790471528031]