{"id":103,"date":"2011-03-23T19:35:00","date_gmt":"2011-03-24T00:35:00","guid":{"rendered":"https:\/\/www.chrystalsander.com\/blog\/?p=103"},"modified":"2023-07-26T12:32:11","modified_gmt":"2023-07-26T17:32:11","slug":"setting-datetime-value-to-zero","status":"publish","type":"post","link":"https:\/\/www.chrystalsander.com\/blog\/?p=103","title":{"rendered":"SQL: Setting DateTime Value to Zero"},"content":{"rendered":"<p style=\"\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;\">&#8211;using DATEDIFF can set the time portion of your DateTime value to zeros &#8211;Handy!<br \/><\/span><\/p>\n<p style=\"color: rgb(0, 0, 153);\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">DECLARE @Day DATETIME<br \/><\/span><\/p>\n<p style=\"color: rgb(0, 0, 153);\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">SET @Day = DATEADD(DAY, -7, DATEDIFF(Day, 0, GETDATE()))<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8211;using DATEDIFF can set the time portion of your DateTime value to zeros &#8211;Handy! DECLARE @Day DATETIME SET @Day = DATEADD(DAY, -7, DATEDIFF(Day, 0, GETDATE()))<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[50],"_links":{"self":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/103"}],"collection":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":1,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":182,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/182"}],"wp:attachment":[{"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chrystalsander.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}