title: How to Convert Month Name to Month Number in java Using JCombobox
body: <p>Hello Guys i want to convert Month name to Month number, i am using a code form but it looks like childish. </p>
  
  <p>i have 12 month in JCombobox</p>
  
  <pre><code>        JCombobox month_sands = new JComboBox();
  
          month_sands.addItem("January");
          month_sands.addItem("February");
          month_sands.addItem("March");
          month_sands.addItem("April");
          month_sands.addItem("May");
          month_sands.addItem("June");
          month_sands.addItem("July");
          month_sands.addItem("August");
          month_sands.addItem("September");
          month_sands.addItem("October");
          month_sands.addItem("November");
          month_sands.addItem("December");
  </code></pre>
  
  <p>So here i want to get the month number when i select the month</p>
  
  <p>Example i have written a code to convert the month to number, </p>
  
  <pre><code>String month=null;
   if(month_sands.getSelectedItem().equals("January"))
      {
          month="01";
      }
      if(month_sands.getSelectedItem().equals("February"))
      {
          month="02";
      }
      if(month_sands.getSelectedItem().equals("March"))
      {
          month="03";
      }
      if(month_sands.getSelectedItem().equals("April"))
      {
          month="04";
      }
      if(month_sands.getSelectedItem().equals("May"))
      {
          month="05";
      }
      if(month_sands.getSelectedItem().equals("June"))
      {
          month="06";
      }   
      if(month_sands.getSelectedItem().equals("July"))
      {
          month="07";
      }
      if(month_sands.getSelectedItem().equals("August"))
      {
          month="08";
      }
      if(month_sands.getSelectedItem().equals("September"))
      {
          month="09";
      }
      if(month_sands.getSelectedItem().equals("October"))
      {
          month="10";
      }
      if(month_sands.getSelectedItem().equals("November"))
      {
          month="11";
      }
      if(month_sands.getSelectedItem().equals("December"))
      {
          month="12";
      }
  </code></pre>
  
  <p>but am not Happy with this code, is there any other way to make it short form</p>