Quantcast
Channel: VBForums - Database Development
Viewing all articles
Browse latest Browse all 2918

Need help on date subtraction

$
0
0
Hi.
I have an issue.
I need to extend some dates but here is my problem.
I need to extend the date of a registration to the amount of November 2 and forth.
Meaning if someone had a registration at 2020-07-15 , he has already used 3 and a half months so we should get an extension of 8 and a half.
so the current date + 8 and a half months.

Does this look correct?

Code:

DATEADD(day,DATEDIFF(day,'20201102',dateadd(year, -1, mm.membership_expires)) + DATEDIFF(day, dateadd(year, -1, mm.membership_expires),GETDATE() ),mm.membership_expires ) as addedmonths,
Please note I'm substituting a year so I can get the initial registration date as the registrations are yearly.

Thanks.

Viewing all articles
Browse latest Browse all 2918

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>