I am trying to view a date of up to 60 days of a certain date in this date format: March 03, 2013 .. how can I subtract 60 days from this date ... I used this code, but didn’t work, because it subtracts only from days and does not deduct from the month or year:
Select LTRIM(DAY(@date - 60))+'-'+CONVERT(varchar(3), DATENAME(MONTH,@date))+'-'+LTRIM(YEAR(@date))
Any help?
try it -
select REPLACE(CONVERT(VARCHAR(11), DATEADD(dd, -60, cast('03-Mar-2013' as date)), 106), ' ', '-') AS [DD-Mon-YYYY]
Try
Select DateAdd(DD,-60,cast('03-Mar-2013' as date))
Returns
2013-01-02
To formatt
Select Replace(Convert(varchar(11),DateAdd(DD,-60,cast('03-Mar-2013' as date)),106),' ','-')
02-Jan-2013
Source: https://habr.com/ru/post/1659412/More articles:else does not return to the loop - python-3.xDuplicate gem selection fails after updating Rails 5 using undefined `select_recurring 'method - ruby-on-rails-5How to recreate an image using HTML and CSS? - cssInvoking a virtual member in the Entity Framework constructor - constructorSort alphanumeric data in Oracle - sqlChange svg image color with CSS - htmlCan I import imports of another template in Jinja? - jinja2Elasticsearch 5 creates in-memory node for testing - elasticsearchVSCode Setting $ Parameter for? - configurationJulia is a fixed-size array in structure C - cAll Articles