vb6.0_MonthNumber_to_MonthName

280 pts.
Tags:
VB
VB 6
Visual Basic 6
Visual Basic Month Function
Hi Experts In Visual Basic 6.0 I coded for month name eg. msgbox MonthName(1,True) Returned as Jan But I want the Month Number juslike above any code please provide eg. msgbox MonthNumber(Jan,true)

Answer Wiki

Thanks. We'll let you know when a new response is added.

I think there is not a function for that, but you could write one, which would be very simple.

Something like:

<pre>Private Function MonthNumber(month As String)
Select Case UCase(month)
Case “JAN”
MonthNumber = 1
Case “FEB”
MonthNumber = 2
Case “MAR”
MonthNumber = 3


Case Else
MonthNumber = 0
End Select
End Function</pre>

If you don’t want to write such a function, you could use the the Month function, which takes a date as a parameter, so you could artificially construct a date with you desired month.

For example, if you want the month number for “Apr”, you use the Month function like this:

<pre>MsgBox Month(“Apr” + “-01-2000″)</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following