How to determine the dates by the number of days from now - "What date is 180 days?"
DATEADD(d, 180, GetDate())
SELECT DATEADD(day, 180, getdate())
getdate() + 180
eg:
select getdate() as Today, getdate() + 180 as About6MonthsLater
Since you just need a date, part of the time should be deleted after the calculation is complete.
SELECT CONVERT (DATETIME, CONVERT (VARCHAR (20), DATEADD(d, 180, GetDate()), 101))
To find 180 days in advance and remove the time component at a time.
Do not rely on internal implementation (using +) or line processing to interrupt time.
SELECT DATEADD(day, DATEDIFF(day, 0, GETDATE()), 180)
Source: https://habr.com/ru/post/1734081/More articles:Создание физической памяти из пользовательского пространства для использования для передачи DMA - memory-managementWhat is the best way to prevent customers from evaluating a product more than once? - ratingis there a limitation for command.getstatusoutput () command buffer in python - pythonC (++) malloc confusion - c ++Can I disable E_STRICT for library code, but not my code? - phpCode Golf: C #: convert ulong to hexadecimal string - c #Internet Based Musical and Sound Synthesis - Overview - javascriptHow to choose which version of the Visual C ++ libraries compiled? - c ++Is there a green light control panel for tfs? - tfsWhat is the best way to filter arraylist content? - arraylistAll Articles