title: Convert HHMM String to GMT format in Java
body: <p>I need to convert a String of the form HHMM (in EST or EDT - today) into a GMT timestamp of the form YYYYMMDD-HH:MM:SS.  So if I get 1512, I want to express 3:12EDT in the GMT time and format: 20110714-20:12:00.  How can I do this?</p>
  
  <p>I have tried the following code and it does not convert at all.  </p>
  
  <pre><code>    int hour = Integer.parseInt(HHMM.substring(0, 2));
      int min  = Integer.parseInt(HHMM.substring(2, 4));
  
      Date day = new Date();
      day.setHours(hour);
      day.setMinutes(min);
      day.setSeconds(00); 
      DateFormat gmtFormat = new SimpleDateFormat();
      gmtFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  
      gmtFormat.format(day);
  
      return day.getYear() + "" + day.getMonth() + "" + 
             day.getDate() + "-" + day.getHours() + ":" + 
             day.getMinutes() + ":" + day.getSeconds();
  </code></pre>