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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change whole month to number November --> 11

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
JP
Am stuck on one.
Does anyone know how to change a variable holding the name of a month (November) to its numeric number 11
Any ideas?
 
Get the month's name whith this: MonthName(10, True)

' 10=october, TRUE means full name, FALSE=abbreviated name

All you need is your month number... ;-)

<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim Myvar,Mymonth
MyVar=Month(Now)
Mymonth=MonthName ((Myvar), False)
%>
The month: <%=Mymonth%> Have Fun...

Sharky99 >:):O>
 
Always good to know have added it to my code.
Sharky can you explain to me how to do it in reverse.
 
Ok i changed it :


Code:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim MonthArray, MonthNmbr, MonthName, countr
MonthArray=Array(&quot;january&quot;,&quot;february&quot;,&quot;march&quot;,&quot;april&quot;,&quot;may&quot;,&quot;june&quot;,&quot;july&quot;,&quot;august&quot;,&quot;september&quot;,&quot;october&quot;,&quot;november&quot;,&quot;december&quot;)
MonthName=&quot;november&quot;
for countr = 0 to ubound(MonthArray)
if MonthArray(countr) = MonthName then
MonthNmbr = countr +1
end if
next
%>
<HTML>
<HEAD>
<TITLE>Month Number from Name...</TITLE>
</HEAD>
<BODY >
Month number: <%=MonthNmbr%>
</BODY>
</HTML>

Hote it'll help ;-) if yes, please mark it.

Have Fun...

Sharky99 >:):O>
 
Freaky,
This VBscript seems to have a very cut compared to VB.
Good of you to help me out
 
Do you get it???

MonthName is the var in which you'll enter the month's name.(be sure it's in lower case)

If it helps, please mark it.

Have Fun...

Sharky99 >:):O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top