By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,078 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,078 IT Pros & Developers. It's quick & easy.

Subtract Two Years From Current Date

P: 68
Hi everybody,

I want to create a code that subtract two years from the current date and returns the data.

For instance

Current date= 05/05/2009
Date before two years=current date-(2 years)
Date before two years=MM/DD/YYYY

Appreciate your cooperation
May 5 '09 #1
Share this Question
Share on Google+
3 Replies


JustJim
Expert 100+
P: 407
@ahd2008
Hi,

The function you want is DateAdd

Expand|Select|Wrap|Line Numbers
  1. dtPrevious = DateAdd("yyyy", -2, dtCurrent)
Please read the help file for DateAdd for further usage of the Interval argument ("yyyy" in this example).

Jim
May 5 '09 #2

P: 68
thanks a lot bro and thx for the advice too
May 5 '09 #3

JustJim
Expert 100+
P: 407
No problem, glad to be of assistance.

Jim
May 5 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.