There is a date"January 1, 1970", there is a variable that always contains the string of the month(cut off with spaces), you must get the month number in the month_number variable(in the case of"January" month_number=1).

===
solved the problem like this

2 Answers 2

var m={
   January: 1,
   February: 2,
   March: 3,
   April: 4,
   "May": 5,
   "June": 6,
   "July": 7,
   August: 8,
   September: 9,
   "October": 10,
   November: 11,
   "December": 12
};

<m["January"]
>1
It seems to be so, although it will be better to decide on months at once, they will end in"Ü" or"I".
///Quickly and immediately change the string on the fly var str="January 1, 1844"; var newStr=str.replace(/\ d + \ s +([^] +) \ s + \ d + /, function(str, s1, s2) {      var sN="";      if(s1[s1.length-1] ==='i')               sN=s1.substring(0, s1.length-1) +"ь";      else sN=s1;     if(sN&m[sN]!="undefined") return str.replace(s1, m[sN]);      else Return str; }); //Get the month number var number; var mouth="January 1, 1844" .match(/\ d + \ s +([^] +) \ s + \ d + /)[1]; number=m[mouth];  if(number == undefined)            number=m[mouth.substring(0, mouth.length-1) +"ь"];