Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
79
rated 0 times [  80] [ 1]  / answers: 1 / hits: 23447  / 12 Years ago, thu, november 1, 2012, 12:00:00

I'm trying to find the corresponding month number from a given month name. What the easiest way of achieving this is?


More From » javascript

 Answers
35

There is not really a need for jQuery in this case.



JavaScript along these lines might help:



var monthNumber = [january, february, march].indexOf(monthname.toLowerCase()) + 1;


Expand the array with all months to make it fully functional.


[#82251] Tuesday, October 30, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rossthomasn

Total Points: 122
Total Questions: 78
Total Answers: 105

Location: South Georgia
Member since Sun, Aug 8, 2021
3 Years ago
;