ASP Month Number from Month Name
ASP Best Practices
ASP comes with a function to turn a number into a month name but what if you have the month name and want the number? Here's how.
Date : 2006-03-09
ASPs date functions have shorted us again. Here is a quick and simple method of getting the Month Number from a full month name or even an abbreviated month name.
tmn = 0
m_name = trim(m_name)
for x=1 to 12
if (strcomp(m_name,MonthName(x,false),vbTextCompare) = 0) OR (strcomp(m_name,MonthName(x,true),vbTextCompare) = 0) then
tmn = x
MonthNumber = tmn
This function is the opposite of the MonthName(MonthNum) function. Let me know if you can think of any optimizations to this function.
No comments yet