Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the number of a specified month

Status
Not open for further replies.

biddingbong

IS-IT--Management
Sep 10, 2004
67
MU
Is there a function in VB to get the number of a specified month?
 
Try the built in Month function,
Code:
MyMonth = Month(Date)

zemp
 
What do yo mean???

Do you want to say give me the number of "September" ?
OR
Do you want to say give me the number of "2004/09/27" ?
Then this would work ...
Function Month(Date)
Member of VBA.DateTime
Returns a whole number representing the month of the year

[flowerface]

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
I mean if I input "May", Im gonna get 5, December Im gonna get 12 and so on..

Code:
Public Function GetMonthNumber(strMonth as String) as Integer
Select Case UCase(strMonth)
Case "JANUARY": GetMonthNumber=1
.
.
.
End Select
End Function

The function looks so silly..
Thats why Im looking for a built-in Function if there's any.
 
How about this?

Code:
GetMonthNumber = Month(DateValue("1 " & strMonth & " 2004"))

Rog


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top