Date Calculation with specific date

Kenny Gua 431 Reputation points
2023-03-28T12:43:14.1+00:00

Heloo, I want to subtract 64.5 years in Eff_Date-2022-12-05 and want to get the result after subtracting 64.5 years (2022-12-05 minus 64.5 yrs).

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,671 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Naomi 7,366 Reputation points
    2023-03-28T13:01:15.2933333+00:00

    Try

    DECLARE @date DATE = '2022-12-05'
    
    SELECT @date, DATEADD(MONTH, -1*64.5*12, @date) AS newDate
    
    
    1 person found this answer helpful.

  2. Naomi 7,366 Reputation points
    2023-03-28T12:58:59.65+00:00

    Try:

    DECLARE @date DATE = '2022-12-05'
    SELECT @date, DATEADD(MONTH, -1*64.5*12, @date) AS newDate
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.