Tutorial by Examples: amont

Using the DATEADD and DATEDIFF functions, it's possible to return the last date of a month. SELECT DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, '2016-09-23') + 1, 0)) -- 2016-09-30 00:00:00.000 SQL Server 2012 The EOMONTH function provides a more concise way to return the last date of a month, and...
If you need to find the last day of the month, you can do complicated DateTime gymnastics or you can use the following method. Say you want to find the last day of February 2021. Do the following: Integer month = 2; Integer day = null; Integer year = 2021; // Create a new DateTime object for ...

Page 1 of 1