Check an example:
declare @today datetime = '2023-01-01'
select dateadd(month, -6, dateadd(year, -64, @today))
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I want to know if today date is '2023-01-01' then I want to deduct 64 year and 6 month to know what will the date (yyyy-mm-dd'). Please provide the query to calculate.
If today date is : 2023-01-01
Assuming less 64.5 year wil be :1958-06-30
Check an example:
declare @today datetime = '2023-01-01'
select dateadd(month, -6, dateadd(year, -64, @today))
if we do calculation from 6 month then get 1958-07-01 result from as per your query and
if we do calculation from 180 days then get 1958-06-30 result. Why one day difference from these two?