EOMONTH()
EOMONTH() is a SQL function in the SQL Server Specific category. SQL Server 2012+: returns the last day of the month containing date. Optional offset to shift months. The syntax is EOMONTH(date [, offset_months]). It accepts date. It returns end-of-month date. A typical example: SELECT EOMONTH(GETDATE()); -- 2026-06-30 SELECT EOMONTH('2026-02-15'); -- 2026-02-28 SELECT EOMONTH(GETDATE(), -1); -- 2026-05-31 (last day of previous month) SELECT EOMONTH(GETDATE(), 1); -- 2026-07-31 (last day of next month) A close relative is OUTPUT Clause, which sQL Server: returns values from DML statements (like PostgreSQL RETURNING). A close relative is STUFF(), which sQL Server: deletes a specified length of characters from a string and inserts another string at the start position. A close relative is FOR XML PATH, which sQL Server: converts query results to XML format. Commonly used for string concatenation hack. More about this category: SQL Server-specific features — T-SQL, OUTPUT, TOP, PIVOT, STUFF, FOR XML.