Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

visual basic add 1 month to variable

Posted on 2004-04-21
4
Medium Priority
?
419 Views
Last Modified: 2006-11-17
I have a program that I need to have the next month.

meaning if today is 4/12/04

then the month is april

I need it to be may

so whatever the current month is it has to end up as May and has to be spelled out like this not 5

any ideas

this is vb6

0
Comment
Question by:hogan9111
  • 2
4 Comments
 
LVL 6

Expert Comment

by:MannSoft
ID: 10882015
You could use DateAdd() to add one month, and MonthName() to turn the number into a name.
0
 
LVL 20

Accepted Solution

by:
hes earned 100 total points
ID: 10882078
Try this

Dim MDate As String
MDate = "04/12/04"
MDate = DateAdd("m", 1, MDate)
MDate = Format(MDate, "m")
MDate = MonthName(MDate)
0
 

Author Comment

by:hogan9111
ID: 10882854
beautiful, thanks
0
 
LVL 20

Expert Comment

by:hes
ID: 10883179
Your Welcome, glad to be able to have helped.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Loops Section Overview

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question