I need to get the last day of the current month. How can I get
set dateformat dmy select dateadd(d, -1, dateadd(m, 1, '01-' + convert(varchar, month(getdate())) + '-' + convert(varchar, year(getdate()))))
add one month to the first of this month, minus one day.
SQLite (sqlite3)
Calculate the last day of the current month.
SELECT date('now','start of month','+1 month','-1 day');
check this link if you use sqlite3 sqlite datetime functions
SQLITE QUERY FOR CALCULATE NUMBER OF DAY FOR A MONTH
select strftime('%d',datetime('now','start of month','+1 month','-1 second'));
Oracle
SELECT LAST_DAY(SYSDATE) AS Last_day_of_month FROM DUAL;
SQL Server
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)) AS Last_day_of_month
Alternative: add the month to the date, and then subtract the total value of the day of the new month:
select day(dateAdd(d, -day(dateAdd(m,1,'2012-01-31')), dateAdd(m, 1, '2012-01-31')))
Source: https://habr.com/ru/post/1737978/More articles:Convert urls to html links using sed? - command-linehow to make asynchronous http requests with epoll and python 3.1 - pythonCalculating row sizes on iPhone in background stream - iphoneRuby on Rails, XML, AJAX, Perl Good Interviews - ruby | fooobar.comReset PChar variable - winapiSQL Where Clause Against View - sql"EntityReference cannot be serialized" when serialized from an ASP.NET website, but works fine in an ASP.NET web application - .netCSS3 box-shadow + inset + RGBA - standardsValue Object and View Model - wpfDisable auto-indexing of certain elements in Visual Studio 2005? - visual-studioAll Articles