vb6.0_MonthNumber_to_MonthName
260 pts.
0
Q:
vb6.0_MonthNumber_to_MonthName
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)
ASKED: Nov 21 2008  6:18 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
29820 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
I think there is not a function for that, but you could write one, which would be very simple.

Something like:

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


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:

MsgBox Month("Apr" + "-01-2000")
Last Answered: Nov 21 2008  1:56 PM GMT by Carlosdl   29820 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0