date function

C

Chris

Hello all. This should be a pretty easy question. The following date
function I'm using gives me the date one year from the current date.
However, it only gives me the fist day of that date one year from now. So
today is 09/18/2009 and my date function gives me 09/01/2010. What I would
like it to do is give me the exact month/day/year one year into the future.
So if my date was 09/18/2009 I would like to return the date of 09/18/2010.
Below is the function I'm currently using. Thanks so much for your help.

DateSerial(Year(Date), Month(Date) + 12, 1)

Chris
 
J

John Spencer

And if you wished to use dateSerial you would need to specify the day also.

DateSerial(Year(Date), Month(Date) + 12, Day(Date))

And since you are going for one year

DateSerial(Year(Date)+1 , Month(Date), Day(Date))

Now that function will give you dates that are different for Feb 29 2008 (any
leap year) then using DateAdd

DateAdd("yyyy",1,#2008-02-29#) returns Feb 28 2009
DateSerial(2008+1,2,29) returns Mar 1 2009

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
C

Chris

Thanks so much!


John Spencer said:
And if you wished to use dateSerial you would need to specify the day
also.

DateSerial(Year(Date), Month(Date) + 12, Day(Date))

And since you are going for one year

DateSerial(Year(Date)+1 , Month(Date), Day(Date))

Now that function will give you dates that are different for Feb 29 2008
(any leap year) then using DateAdd

DateAdd("yyyy",1,#2008-02-29#) returns Feb 28 2009
DateSerial(2008+1,2,29) returns Mar 1 2009

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top