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

Adding one month to a date -- no as easy as it appers!

P: n/a
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards

John Baker
Nov 12 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Look up Dateadd in help
You will use something like DateAdd("m", 1, "31-Jan-95") or DateAdd("m", 1,
"[youdatefieldname]")
HTH
David B

John Baker <Ba******@Verizon.net> wrote in message
news:qg********************************@4ax.com...
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards

John Baker


Nov 12 '05 #2

P: n/a
Look at dateadd in the help, as in:

dateadd("m", 1, #1/1/04#)

Tom

John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. ..
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards

John Baker

Nov 12 '05 #3

P: n/a
Thanks..
I guess it IS as easy as it appears!!!!

Regards

John Baker

John Baker <Ba******@Verizon.net> wrote:
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards

John Baker


Nov 12 '05 #4

P: n/a
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. ..
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards
Not simple but here is what you do.

Break the date down using Month, Day and Year functions into (1,1 and
2003 all integers)
Increment the month by one (2,1 and 2003)
Then convert into strings and concatenate them back into a string
inserting the "/" separator as necessary. ("1/01/2003")
Use DateValue function to convert back into a date value.

John Baker

Nov 12 '05 #5

P: n/a
lo************@hotmail.com (Brian) wrote in
news:f3**************************@posting.google.c om:
John Baker <Ba******@Verizon.net> wrote in message
news:<qg********************************@4ax.com>. ..
HI:

I have a date, and am trying to do something that SHOULD be very simple
-- but finding a problem. Assume the date is 01/01/03. I wish to make
the date 02/01/03, and then next month 03/01/03 and so on. In other
words, I want to add one to the month and reset the date. However,
adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards


Not simple but here is what you do.

Break the date down using Month, Day and Year functions into (1,1 and
2003 all integers)
Increment the month by one (2,1 and 2003)
Then convert into strings and concatenate them back into a string
inserting the "/" separator as necessary. ("1/01/2003")
Use DateValue function to convert back into a date value.


Ouch!

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6

P: n/a
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. ..
HI:

I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards

John Baker


If memory serves, you should be able to use the DateAdd function and
simply do something like:

dim your_date as date
dim next_date as date

your_date = CDate("1/1/03")
next_date = DateAdd("m", 1, your_date)

Cheers,
Steve Cummings
Nov 12 '05 #7

P: n/a
Lyle Fairfield <Mi************@Invalid.Com> wrote in message news:<Xn*******************@130.133.1.4>...
lo************@hotmail.com (Brian) wrote in
news:f3**************************@posting.google.c om:
John Baker <Ba******@Verizon.net> wrote in message
news:<qg********************************@4ax.com>. ..
HI:

I have a date, and am trying to do something that SHOULD be very simple
-- but finding a problem. Assume the date is 01/01/03. I wish to make
the date 02/01/03, and then next month 03/01/03 and so on. In other
words, I want to add one to the month and reset the date. However,
adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.

Is there a simple way to increment dates by a month? If so what is it?

Thanks in advance.

regards


Not simple but here is what you do.

Break the date down using Month, Day and Year functions into (1,1 and
2003 all integers)
Increment the month by one (2,1 and 2003)
Then convert into strings and concatenate them back into a string
inserting the "/" separator as necessary. ("1/01/2003")
Use DateValue function to convert back into a date value.


Ouch!


Thanks. I found the other responses very educational.
Nov 12 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.