{"id":877,"date":"2011-09-16T20:20:11","date_gmt":"2011-09-17T01:20:11","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=877"},"modified":"2021-03-10T20:54:44","modified_gmt":"2021-03-11T01:54:44","slug":"calculate-the-last-day-of-the-month","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/calculate-the-last-day-of-the-month\/","title":{"rendered":"Calculate the Last Day of the Month"},"content":{"rendered":"<p>Here is how to calculate the last day of the current month.<\/p>\n<p><strong>Powerbuilder<\/strong><\/p>\n<pre name=\"code\" class=\"VB\">date ld_eom\n\nld_eom = RelativeDate(Date(String(Month(Today()) + 1) + &quot;\/1\/&quot; + String(Year(Today()))), -1)<\/pre>\n<p><strong>SQL Server<\/strong><\/p>\n<pre name=\"code\" class=\"sql\">SELECT DATEADD(DAY, -1, DATEADD(MONTH, DATEDIFF(MONTH, 0, Getdate()) +1, 0))<\/pre>\n<p>I quess SQL Denali has a new function (EOMONTH) to do this too.<\/p>\n<pre name=\"code\" class=\"sql\">SELECT EOMONTH(GETDATE())<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is how to calculate the last day of the current month. Powerbuilder date ld_eom ld_eom = RelativeDate(Date(String(Month(Today()) + 1) + &quot;\/1\/&quot; + String(Year(Today()))), -1) SQL Server SELECT DATEADD(DAY, -1, DATEADD(MONTH, DATEDIFF(MONTH, 0, Getdate()) +1, 0)) I quess SQL Denali has a new function (EOMONTH) to do this too. SELECT EOMONTH(GETDATE())<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,3,10],"tags":[12,16,15],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/877"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=877"}],"version-history":[{"count":5,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/877\/revisions"}],"predecessor-version":[{"id":1980,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/877\/revisions\/1980"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}